Welcome to the LegalLens project! This repository provides a robust search system for querying laws and articles from the Indian Constitution. Leveraging semantic search and keyword-based search, LegalLens ensures users can find relevant legal texts effectively and intuitively.
- Features
- Prerequisites
- Installation
- Usage
- Flowchart
- Project Structure
- Technologies Used
- Acknowledgements
- Semantic Search: Find articles using natural language queries. For example, search for "freedom of speech laws" and get relevant results.
- Keyword Search: Locate laws using specific terms or phrases.
- Indian Constitution Focus: Exclusively designed to work with the Indian Constitution for targeted and accurate results.
- Efficient Retrieval: Combines the power of embeddings and keyword matching for a fast and relevant search experience.
Before you begin, ensure you have met the following requirements:
1. Python 3.11.9
2. A text editor (e.g., VS Code)
3. Git
Step 1: Clone the repository
git clone https://github.com/AbhinavDShetty/Hack-Babies.gitStep 2: Navigate to project directory
cd Hack-Babies\myprojectStep 3: Install VirtualEnvWrapper
pip install virtualenvwrapper-winStep 4: Create a Virtual Enviroment
mkvirtualenv myvenv -p python3.11Step 5: Activate the Virtual Enviroment
workon myvenvStep 6: Install dependencies
pip install -r requirements.txtStep 7: Run the run_me.py
python run_me.pyStep 8: Run the Server
python manage.py runserver- To stop the server, just press
Ctrl+C. - Note: To deactivate the Virtual Enviroment
deactivate- Start the website by running
python manage.py runserver. - Access the interface through the provided URL (e.g.,
http://127.0.0.1:8000). - Use the search bar to:
- Enter natural language queries for semantic search.
- Enter specific terms for keyword-based search.
- Review the results, which will list relevant laws or articles from the Indian Constitution.
Hack-Babies/
├──myproject/
│ ├──dump files
│ ├──myapp/
│ │ ├──hybrid_search.py # Pre-trained model for semantic search
│ │ ├──urls.py
│ │ └──views.py
│ ├──myproject/
│ │ ├──settings.py
│ │ └──urls.py
│ ├──static
│ ├──templates/
│ │ ├──index.html
│ │ └──search.html
│ ├──db.sqlite3
│ ├──final_database_v1.json # The database of laws and articles
│ ├──Flowchart.png
│ ├──manage.py
│ ├── requirements.txt # Dependencies
│ └──run_me.py
├──.gitattributes
└── README.md
- Programming Language: Python
- Libraries:
django- For building the web interfacejson- For data manipulationsentence-transformers- For semantic model developmentscikit-learn- For semantic search usingcosine_similaritynltk- For keyword search usingnltk.corpus
- Search Techniques:
- Scored keyword-based search
- Embedding-based semantic search
Feel free to reach out with feedback or suggestions. Let's make legal information accessible for everyone!
