$ show Kyle-Kyle/top4grep
top4grep is a command-line tool for searching academic papers from four top security conferences (NDSS, IEEE S&P, USENIX, CCS). It builds a local SQLite database by querying DBLP via SPARQL and optionally scraping abstracts from publisher websites. The tool supports keyword-based querying with stemming for fuzzy matching and sorts results by year and conference precedence. The architecture separates concerns into distinct modules: database operations (__main__.py, db.py, build_db.py), abstract extraction (abstract.py), and utilities (utils.py). The code demonstrates good practices like SQLAlchemy ORM usage, context managers for resource handling, and the Template Method pattern for conference-specific abstract extraction.
The LLM identified 3 files worth highlighting for reuse:
Provides reusable logging configuration with colorized output and custom VERBOSE level, plus context managers for temporary directory/file management and path changes. Isolated from domain logic, depends only on standard library and colorlog, demonstrating solid engineering practices for cross-cutting concerns.
Implements the Template Method pattern for conference-specific abstract extraction. BasePaperAbstract defines the extraction workflow, while concrete classes (AbstractNDSS, AbstractSP, etc.) handle publisher-specific HTML parsing. Shows non-obvious skill in handling varied website structures and fallback mechanisms, with clear separation of concerns.
Defines a reusable SQLAlchemy declarative base mixin (BaseTable) that automatically sets table names to lowercase class names. Eliminates boilerplate in ORM model definitions, demonstrating a clean, DRY approach applicable to any SQLAlchemy project. The Paper model inherits this cleanly.