text_plain_output_3.png text_plain_output_2.png text_plain_output_1.png
from cord import ResearchPapers

from tqdm import tqdm

import pandas as pd

import pandas as pd

keywordlist = ['inhibitor']

research_papers = ResearchPapers.load()

help(research_papers.search)

def loopsearch(keywordlist, researchpaperfu):
    alldataframeco = pd.DataFrame()
    alldataframenoco = pd.DataFrame()
    allcopid = []
    allnocopid = []
    for i in tqdm(keywordlist):
        covinf = researchpaperfu.covid_related().search(i, num_results=1000, covid_related=False, view='table').results[['cord_uid', 'title', 'abstract']]
        notcovinf = researchpaperfu.not_covid_related().search(i, num_results=10000, covid_related=False, view='table').results[['cord_uid', 'title', 'abstract']]
        covinfpid = list(covinf.cord_uid.values)
        notcovinfpid = list(notcovinf.cord_uid.values)
        alldataframeco = pd.concat([covinf, alldataframeco])
        alldataframenoco = pd.concat([notcovinf, alldataframenoco])
        allcopid.append(covinfpid)
        allnocopid.append(notcovinfpid)
    alldataframeco = alldataframeco.drop_duplicates()
    alldataframenoco = alldataframenoco.drop_duplicates()
    return (allcopid, allnocopid, alldataframeco, alldataframenoco)

keywordlist = ['inhibitor']
_, _, allcoab, allnocoab = loopsearch(keywordlist, research_papers)