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?

Asked By: kurious

||

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)
Answered By: xbello

You may add to your query an English filter, like so:

query = "{} AND english[Filter]".format(query)
Answered By: Dimitris Patikas
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.