lukasschwab / arxiv.py

Python wrapper for the arXiv API
MIT License
1.07k stars 120 forks source link

how can I query a specific category #85

Closed pillarxyz closed 2 years ago

pillarxyz commented 2 years ago

is there a simple way to only query the AI category for example instead of all fields that exist in the arxiv ?

lukasschwab commented 2 years ago

Yep! Check out the arXiv API User's Manual: Details of Query Construction.

You want a query with a cat:cs.AI term, e.g. cat:cs.AI AND KBQA:

>>> import arxiv
>>>
>>> cat_search = arxiv.Search(query="cat:cs.AI", max_results=10)
>>> next(cat_search.results()) # A paper in the AI category.
...
>>> search = arxiv.Search(query="cat:cs.AI AND KBQA", max_results=10)
>>> next(search.results()) # A paper in the AI category discussing KBQA.
...