text_plain_output_1.png
from collections import  Counter

from nltk.corpus import stopwords

from nltk.stem import WordNetLemmatizer,PorterStemmer

import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

path = '../input/CORD-19-research-challenge/'
all_sources = pd.read_csv(path + 'metadata.csv')

all_sources.isna().sum()

headline_length = all_sources['title'].str.len()

headline_length = all_sources['abstract'].str.len()

stop = set(stopwords.words('english'))
def build_list(df, col='title'):
    corpus = []
    lem = WordNetLemmatizer()
    stop = set(stopwords.words('english'))
    new = df[col].dropna().str.split()
    new = new.values.tolist()
    corpus = [lem.lemmatize(word.lower()) for i in new for word in i if word not in stop]
    return corpus

corpus = build_list(all_sources)
counter = Counter(corpus)
most = counter.most_common()
x = []
y = []
for word, count in most[:10]:
    if word not in stop:
        x.append(word)
        y.append(count)

plt.figure(figsize=(9, 7))
sns.barplot(x=y, y=x)