JuriLens · Legal research, built in 2024
Court judgments summarised, tagged and searchable in plain language
JuriLens turns a pile of long documents into summaries, tags and plain-language search. Here the pile is Sri Lankan court judgments. They are long, they sit on court websites with thin filters, and the sites sometimes go down. Each night a job collects new judgments and an AI summarises and tags them. A web app then lets people filter by court, type and outcome, or ask in plain words. I designed and built it in 2024 as my master's research at Robert Gordon University, and my report says plainly where the testing fell short.
Each square is one court judgment
Collected overnight, summarised and tagged by an AI, then added to the search index. This grid is an illustration.
- Waiting
- Being read
- In the index
- 1,200+
- court judgments searchable
- 60
- documents checked by hand (100 were planned)
- 89
- legal topics
- 5
- AI models compared
The result
Judgments you can search by meaning and by filter
Each judgment has an AI summary, a case type and tags, and sits in a search index that matches on meaning. People can combine filters for court, type, legal processes, behaviours, entities and outcomes with a plain-language search. The paper's title says RAG, short for retrieval-augmented generation. JuriLens is the retrieval half of that, with the collecting, summarising and tagging built around it. At search time it finds and ranks real judgments and does not write an answer from them. It was research, and it was never sold as a product. It is 2024 work, and the tools have moved on a great deal, so a rebuild would do better.
Where to read it
The abstract is printed on page 5 of the iCIIT Conclave 2024 proceedings on Large Language Models and Generative AI, published by the Informatics Institute of Technology (ISSN 3051-5483).
- Read the proceedings (PDF)
- Read the paper on ResearchGate: Utilizing RAG and Prompt Engineering for Categorization & Summarization of Judgments in the Sri Lankan Jurisprudence
The printed abstract is an early, preliminary summary. The figures on this page are the final ones.
- My role
- Designer, developer and researcher
- The judgments
- 1,200+ Supreme Court and Court of Appeal judgments, English only
- Built
- 2024, as MSc research. Part of the work was presented at the iCIIT Conclave 2024
- Status
- A research project that was never sold as a product
The problem at JuriLens
- In my survey of 36 people, mostly law students, none said they were satisfied with how they find judgments. Just over half were neutral and the rest dissatisfied.
- 89.6% said judgments come without summaries, and 83.3% said the relevant ones are hard to find.
- Court websites offer weak filters, and while I was collecting judgments they went down often enough to notice.
- Third-party legal tools sit behind paywalls.
What I built at JuriLens
- A job runs every night, collects new judgments from both courts and splits the text.
- An AI summarises each judgment in stages, then adds the case type and tags.
- The summaries go into an index that matches on meaning as well as exact words.
- A web app combines filters with plain-language search.
What a search looks like
Three searches from my test plan. A pass there means the app returned matching cases. It does not measure how well they were ranked.
- You type
- “cases about murder and theft”
- Filters
- None
- What happens
- Your words are compared with the summary of every judgment, and the matches come back as a list.
- You type
- “criminal intent”
- Filters
- Court of Appeal, and police as an entity
- What happens
- The filters and the meaning search work together, so only matching cases from that court appear.
- You type
- Nothing
- Filters
- Civil
- What happens
- With no text, the app skips the meaning search and lists cases straight from the database using the filters.
One more test searches a made-up word, and the app correctly says "No results found".
What I did at JuriLens
An overnight collection job
Every night at midnight it checks the Supreme Court and Court of Appeal sites, downloads new judgments, cleans the text and splits it into parts small enough for an AI model to read well. The Court of Appeal site has two page layouts, so the job reads both.
Summaries in stages
Each part gets a summary, then the summaries are combined into one for the whole judgment. I asked for about 250 words that stay close to the judgment's own wording, because a first attempt at a shortcut missed important details.
Case type and tags
From the combined summary the AI marks a case as civil or criminal and adds tags from a fixed list. The list covers 89 legal topics and the themes that cut across them. One case can carry many tags, so it can be found from more than one angle.
Search by meaning
Each summary becomes a numeric fingerprint of its meaning, stored in a vector database. A question gets the same treatment, and the closest summaries come back. A similarity cut-off, set by trial and error, drops weak matches.
A web app with filters
Court, type, legal processes, behaviours, entities, outcomes, and civil and criminal tags sit beside the search box, with sign-in and admin roles.
Five models compared
I tested GPT-4o, GPT-4o-mini, GPT-3.5, Llama-3-8B and Mistral-7B on two jobs. For tagging, GPT-4o scored an F1 of 0.947, where 1 is a perfect score. The other four scored between 0.158 and 0.269. GPT-4o also drafted the answer key that people then reviewed, which favours it, so read that gap with care. For summaries, the small open model Llama-3-8B came closest in meaning to the full text (0.908 against 0.885 for GPT-4o), although its tagging scored 0.237. GPT-4o-mini and GPT-3.5 trailed on both jobs.
Built with: GPT-4o, GPT-4o-mini, GPT-3.5, Llama-3-8B (Together AI), Mistral-7B, OpenAI embeddings (text-embedding-3-small), Pinecone, MongoDB, AWS Lambda and Step Functions, React, Fastify, ROUGE, F1.
What the testing can and cannot show
My report states these limits next to the results. They are also the first things to check in any similar project.
- GPT-4o drafted the answer key for tagging and was also one of the models scored, which can flatter it. The report says so too.
- The human check covered about 60 of the 100 cases planned, by two law students. Family law was not in the sample, and commercial and labour cases made up 5% each.
- Search quality was checked with 19 pass/fail tests. I did not measure how often the right case comes back, so there is no hit rate to quote. The meaning search uses a general-purpose model that was not built for law.
- User testing was thin: law students tried the app and their feedback shaped the interface, and the report gives no scores. The survey was mostly students.
- It holds its own copy of every judgment, so it should keep working when the court sites are down, but I never ran an outage test. When the Supreme Court site changed, the collection job broke and needed a rebuild, which is the risk in any build that depends on someone else's website.
- It covers English-language Supreme Court and Court of Appeal judgments only. AI summaries can be wrong, and the app labels them as AI-written.
What I would build today
JuriLens was built in 2024, on the tools of that year, free-tier hosting and a small budget. This is what I would change in a rebuild, and the limit each change answers.
01
Answers that show their sources
Ask a question and get a short answer written from the retrieved judgments, with the case and passage beside each claim, so every line can be checked. If the sources are thin, it says so.
The limit it answers: the 2024 build returned a list of cases and wrote no answer, and early model outputs sometimes gave wrong information with confidence.
02
Keywords and meaning together, then re-ranked
A section number or a case name needs exact words, and a plain-language question needs meaning. A rebuild would run both and merge the results, then reread the top few cases against the question and put the best one first.
The limit it answers: the 2024 search used meaning only, with a cut-off found by trial.
03
Search quality with real numbers
A set of real questions with the right cases marked by lawyers, so I can report how many of the top ten results are right and re-test after every change.
The limit it answers: retrieval was checked with pass/fail tests only, and the answer key was drafted by a model that was also scored.
04
Less stitching for long judgments
Models can read much longer text in one pass and cost less per page. I would test whether fewer, larger pieces keep more detail than the 2024 chunk-by-chunk approach, and keep the staging only where it wins.
The limit it answers: each judgment was cut up, summarised piece by piece, then combined.
05
A legal-aware search model
Test an embedding model built for legal text, or tuned on Sri Lankan judgments, against the general-purpose one, scored on the test set from item 3.
The limit it answers: the 2024 model was general-purpose.
06
Sinhala and Tamil
Extend search beyond English, with native speakers checking the results.
The limit it answers: English only.
07
Links between cases
Show which judgments cite which, and follow a precedent through later decisions.
The limit it answers: each case was searched on its own summary, with no links between cases.
Also on the list: a human review step for summaries the system flags as uncertain, and hosting that stays up, since the 2024 build ran on free tiers.
Several of these come from the future work listed in my report. It is a plan, and none of it is built.
Have a pile of documents nobody can search?
Contracts, reports, tickets, case files. If people have to remember the right word to find the right page, the same approach may help. I have tested it on English court judgments only, so I would sign an NDA and try a small sample of your documents before promising anything. The first step is a free call.