A comprehensive information retrieval system with multiple vectorization methods including TF-IDF, BM25, and hybrid approaches.
- Multiple Vectorization Methods: TF-IDF, BM25, and Hybrid search
- GUI Interface: PyQt6-based graphical user interface
- Dataset Support: Integration with ir_datasets for various datasets
- Text Processing: Advanced preprocessing with NLTK
- Model Persistence: Save and load trained models
- Python 3.8 or higher
- pip
# Clone the repository
git clone <repository-url>
cd ir_project
# Install the package
pip install -e .pip install -r src/requirements.txt# Run the main application
python src/main.py
# Or if installed as a package
ir-project# Run the GUI application
python src/gui/gui.pyfrom src.config import DEFAULT_DATASET
from src.loader import load_dataset_with_queries
from src.services.online_vectorizers.bm25 import bm25_search
# Load dataset
docs, queries, qrels = load_dataset_with_queries(DEFAULT_DATASET)
# Perform search
results = bm25_search(DEFAULT_DATASET, "your query here", top_k=10)src/
├── __init__.py # Main package
├── main.py # Main application entry point
├── config.py # Configuration settings
├── loader.py # Dataset loading utilities
├── evaluation.py # Evaluation metrics
├── gui/ # GUI components
│ ├── __init__.py
│ ├── gui.py # Main GUI application
│ └── ir_engine.py # Search engine interface
└── services/ # Core services
├── __init__.py
├── online_vectorizers/ # Real-time search services
│ ├── __init__.py
│ ├── bm25.py
│ ├── hybrid.py
│ ├── tfidf.py
│ ├── embedding.py
│ └── inverted_index.py
├── offline_vectorizers/ # Model training services
│ ├── __init__.py
│ ├── bm25.py
│ ├── hybrid.py
│ ├── tfidf.py
│ └── embedding.py
└── processing/ # Text processing utilities
├── __init__.py
├── preprocessing.py
└── docs_processor.py
The system supports various datasets through ir_datasets:
- antique: Question-answer dataset with natural questions from real users
- beir/quora: Quora question pairs dataset from the BEIR benchmark
Best Matching 25 (BM25) is a ranking function used by search engines to rank matching documents according to their relevance to a given search query.
Term Frequency-Inverse Document Frequency is a numerical statistic that reflects how important a word is to a document in a collection.
The system supports dense retrieval using BERT-based embeddings. Documents and queries are encoded into dense vectors using a pre-trained BERT model, and similarity is computed (typically via cosine similarity) to rank results.
Combines multiple ranking methods for improved search results.
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black src/
# Lint code
flake8 src/- Create a new file in
src/services/offline_vectorizers/for training - Create a new file in
src/services/online_vectorizers/for search - Update the respective
__init__.pyfiles - Add the new model to
SearchModelenum insrc/gui/ir_engine.py
This project is licensed under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- ir_datasets for dataset access
- rank_bm25 for BM25 implementation
- NLTK for text processing