A comprehensive question-answering system for Vietnamese legal documents, featuring semantic search and natural language processing capabilities.
This project implements an intelligent legal assistant that can answer questions about Vietnamese laws across multiple legal domains including:
- Civil Law (Bộ luật Dân sự)
- Criminal Law (Bộ luật Hình sự)
- Labor Law (Bộ luật Lao động)
- Criminal Procedure Law (Bộ luật Tố tụng Hình sự)
- Land Law (Luật Đất đai)
- Marriage and Family Law (Luật Hôn nhân và Gia đình)
.
├── backend/ # Backend server implementation
│ ├── data/ # Legal document corpus
│ ├── legal_index/ # FAISS vector indices
│ ├── models/ # NLP models and processors
│ └── src/ # Source code
│ ├── api/ # FastAPI routes and endpoints
│ ├── core/ # Core business logic
│ └── utils/ # Helper utilities
├── frontend/ # Next.js frontend application
│ ├── app/ # Page components
│ └── components/ # Reusable UI components
└── legal_index/ # Preprocessed vector indices
- Semantic Search: Utilizes FAISS for efficient similarity search across legal documents
- Natural Language Processing: Leverages VnCoreNLP for Vietnamese text processing
- Modern Web Interface: Built with Next.js for a responsive user experience
- RESTful API: FastAPI-based backend with documented endpoints
- Multi-domain Support: Handles questions across multiple areas of Vietnamese law
- Python 3.9+
- Node.js 16+
- Java Runtime Environment (for VnCoreNLP)
- Create and activate a virtual environment:
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Start the backend server:
python run.py- Install dependencies:
cd frontend
npm install- Start the development server:
npm run devThe application will be available at http://localhost:3000
Once the backend server is running, API documentation is available at:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Run the test suite:
cd backend
python -m pytest tests/The system includes evaluation scripts and metrics in the backend/evaluation/ directory:
- Question-answering accuracy
- Response relevance
- Processing speed
This project is part of a thesis work. All rights reserved.
Do Duy Hiep