Adithya. ← All work
PROJECT 01 · RAG · LEGAL RESEARCH

Niyamadharshini

An AI-powered legal research assistant that makes bulky Malayalam legal documents searchable, understandable and easier to navigate.

FlaskChromaDBBGE-M3GeminiPaddleOCRTesseractPyMuPDFBM25BGE-Reranker
Watch the demo ↗ Demo
niyamadharshini, demo
Screenshot of Niyamadharshini answering a question about 2024 land bills in Malayalam, citing the source PDF and page
THE STORY

Built for my mother.

Niyamadharshini was born out of a real problem I saw through my mother, who works in the court system. Important legal documents often sit buried inside lengthy, scanned PDFs written in Malayalam, making it difficult to find the exact information someone needs. Niyamadharshini turns those documents into a searchable knowledge base and answers questions with references to the original source pages, so you can trace an answer back to the document instead of blindly trusting an AI response.

HOW IT WORKS

From scanned PDF to cited answer.

InputInterfaceBackendAI modelDataOutput
1 · INGESTIONUNCHANGED
2 · HYBRID RETRIEVALUPDATED
3 · ANSWERNEW FLOW
Kerala Assembly PDFs
PDF type?
PyMuPDF
embedded text
PaddleOCR + Tesseract
scanned text
Clean text
remove headers and footers
Chunk text
attach source, page, ID
BGE-M3 embeddings
multilingual model
Chroma DB
1,297 records
text-based
scanned
User query
Malayalam or English
Query embedding
BGE-M3
Malayalam normalization
spelling, endings
Semantic search
retrieve by meaning
BM25 keyword search
exact terms, IDs, amounts
RRF fusion
merge ranked results
Top 30 candidates
BGE-Reranker-v2-m3
score query and chunk relevance
Top 10 chunks
with metadata
if reranker fails: skip
vectors
chunk text for BM25
top 10
Gemini
answer from retrieved context
Add citations
PDF and page number
Chat interface
frontend
Answer shown
conversation history kept
if BM25 fails: semantic only
dashes show the data flow; dotted lines are fallbacks ↑
KEY FEATURES

What it does.

01

Document ingestion pipeline

Processes bulky Malayalam legal PDFs, including scanned documents, to make their contents searchable.

02

OCR and hybrid retrieval

Combines semantic search with BM25 keyword search, merges them with RRF fusion and reranks the top 30 candidates down to the best 10 chunks.

03

Grounded AI answers

Uses Gemini to answer from retrieved legal content rather than general model knowledge alone.

04

Source-level citations

Links each answer to its source documents and page numbers, so you can verify it yourself.

05

Multilingual accessibility

Designed around the challenges of Malayalam legal documents, using open-source tools and language models.

06

Built around a real need

Solves a practical document-search problem, with a longer-term vision of making large legal collections easier to access and maintain.