How promiseom/expansion-model works
This repository provides a query-expansion API: a client supplies a query, the Flask endpoint asks the expansion model for candidate terms, and the endpoint refines those terms before returning an expanded query (or the original query if expansion fails). The model’s sampled code retrieves Wikipedia material and uses asynchronous tasks to gather related-page data; the included WordNet and Google-search modules are distinct capabilities, but their connection to the API workflow is not established by the excerpts. Some model internals are omitted, so only evidenced relationships are shown.
Main entry points: qe_model.py Expansion model · wsgi.py Expansion endpoint · prd_retrieval.py Wikipedia retrieval · custom_search.py Google custom search
Components 12
API layer
- Expansion endpoint
wsgi.py
Expansion workflow
- Expansion model
qe_model.py - Term refinement
term_selector.py - Async task manager
asynctask.py - Run logging
messagelogger.py
Search and retrieval
- Wikipedia retrieval
prd_retrieval.py - Google custom search
custom_search.py
Supporting modules
- WordNet expansion
wordnet_query_expansion.py - Wiki link extractor
wiki_term_retrieval.py
Other components
- API client
- Wikipedia API
- Google search service
Connections 9
- API client → Expansion endpoint: requests expansion
wsgi.py - Expansion endpoint → Expansion model: gets candidates
wsgi.py - Expansion endpoint → Term refinement: refines terms
wsgi.py - Expansion model → Async task manager: runs tasks
qe_model.py - Expansion model → Run logging: logs progress
qe_model.py - Expansion model → Wikipedia retrieval: cleans extracts
qe_model.py - Expansion model → Wikipedia API: requests pages
qe_model.py - Wikipedia retrieval → Wikipedia API: searches articles
prd_retrieval.py - Google custom search → Google search service: searches web
custom_search.py