Applying language filter to Entrez.esearch and Entrez.efetch
Question:
I’m querying PubMed for some results using Biopython
. This is a portion of the code:
def search(query):
Entrez.email = '[email protected]'
handle = Entrez.esearch(db = 'pubmed',
sort = 'relevance',
retmax = '30000',
retmode = 'xml',
term = query)
results = Entrez.read(handle)
return results
I want to the results to have papers only in English. I checked the documentation at http://www.ncbi.nlm.nih.gov/books/NBK25499/ but found no attributes for this filter.
PubMed
‘s manual search allows filtering by language. How should I modify the code?
Answers:
You can modify the search term as shown below:
query = "{} AND English[Language]".format(query)
handle = Entrez.esearch(db='pubmed',
sort='relevance',
retmax='30',
retmode='xml',
term=query)
You may add to your query an English filter, like so:
query = "{} AND english[Filter]".format(query)
I’m querying PubMed for some results using Biopython
. This is a portion of the code:
def search(query):
Entrez.email = '[email protected]'
handle = Entrez.esearch(db = 'pubmed',
sort = 'relevance',
retmax = '30000',
retmode = 'xml',
term = query)
results = Entrez.read(handle)
return results
I want to the results to have papers only in English. I checked the documentation at http://www.ncbi.nlm.nih.gov/books/NBK25499/ but found no attributes for this filter.
PubMed
‘s manual search allows filtering by language. How should I modify the code?
You can modify the search term as shown below:
query = "{} AND English[Language]".format(query)
handle = Entrez.esearch(db='pubmed',
sort='relevance',
retmax='30',
retmode='xml',
term=query)
You may add to your query an English filter, like so:
query = "{} AND english[Filter]".format(query)