lukasschwab / arxiv.py

Python wrapper for the arXiv API
MIT License
1.11k stars 123 forks source link

How to group boolean operators to form complex queries? #86

Closed yelmankhan008 closed 2 years ago

yelmankhan008 commented 2 years ago

How can I use multiple ANDs? For example, if I want to get a paper that has the concepts "semantic parsing" and "parsers" in its abstract, how can I form a query for it. I only want to retrieve the papers that have both the concepts. I have tried following but I don't get the correct results:

query = 'abs:"semantic parsing" AND "abs:parsers"'

And how can this be achieved for multiple concepts? Thanks!

lukasschwab commented 2 years ago

I think you've misplaced a double-quote:

- query = 'abs:"semantic parsing" AND "abs:parsers"'
+ query = 'abs:"semantic parsing" AND abs:"parsers"'

In practice:

>>> import arxiv
>>> s0 = arxiv.Search(query='abs:"semantic parsing" AND abs:"parsers"', max_results=10)
>>> for result in s0.results():
>>>   print(result.summary, "\n")

And how can this be achieved for multiple concepts?

I don't understand what you're asking here––if you have another question, can you give an example? Closing for now.