How myselfsiddharth/legalai works
This repository is a legal-AI research pipeline for extracting structured legal concepts from judgments, checking cited authorities against citation metadata, and studying signed citation networks and model baselines. A user-facing run can process a case through ontology-guided extraction, citation verification, and an IRAC report; batch evaluation scores those outputs. Separate data-preparation and graph-analysis branches build the case sample and signed citation graph. Relationships are limited to excerpted code references and documented inputs/outputs; several listed modules were not sampled, so their internal behavior is represented only at subsystem level.
Main entry points: ode_lib.py Grounding library · phase3_verify.py IRAC verification · citations_classified.jsonl Citation metadata · fetch_sample_pdfs.py PDF retrieval
Components 23
Case preparation
- Land-dispute data
Data/Legal AI Dataset - Citation metadata
Data/processed/citations_classified.jsonl - Case sampling
scripts/build_sample.py - Drive index
scripts/build_drive_index.py - PDF retrieval
scripts/fetch_sample_pdfs.py - Judgment PDFs
Legal extraction
- ODE pipeline
scripts/ode_pipeline.py - Grounding library
scripts/ode_lib.py - Legal ontology
scripts/ontology/land_dispute_ontology.json - Learned rules
scripts/ontology/learned_rules.json - IRAC verification
scripts/phase3_verify.py - IRAC reports
Data/processed
Citation analysis
- Headnote sign extraction
scripts/extract_headnote_signs.py - Modern sign classification
scripts/classify_modern_signs.py - Signed citation graph
scripts/build_signed_graph.py - Graph scores
Data/processed
Evaluation
- Batch evaluation
scripts/run_evaluation_batch.py - Baseline comparison
scripts/run_baselines.py - Evaluation metrics
scripts/eval_lib.py - Evaluation results
Data/processed
Other components
- Researcher
- LLM service
- Google Drive
Connections 28
- Researcher → ODE pipeline: runs extraction
scripts/ode_pipeline.py - Land-dispute data → Case sampling: provides cases
scripts/build_sample.py - Citation metadata → Case sampling: filters cases
scripts/build_sample.py - Case sampling → PDF retrieval: selects cases
scripts/fetch_sample_pdfs.py - Drive index → PDF retrieval: indexes files
scripts/fetch_sample_pdfs.py - PDF retrieval → Google Drive: downloads PDFs
scripts/fetch_sample_pdfs.py - PDF retrieval → Judgment PDFs: writes PDFs
scripts/fetch_sample_pdfs.py - ODE pipeline → Grounding library: uses grounding
scripts/ode_pipeline.py - Grounding library → LLM service: grounds sentences
scripts/ode_lib.py - Grounding library → Legal ontology: loads ontology
scripts/ode_lib.py - Grounding library → Learned rules: loads rules
scripts/ode_lib.py - IRAC verification → Grounding library: reuses extraction
scripts/phase3_verify.py - IRAC verification → Citation metadata: checks authorities
scripts/phase3_verify.py - IRAC verification → IRAC reports: writes report
scripts/phase3_verify.py - Headnote sign extraction → Judgment PDFs: reads PDFs
scripts/extract_headnote_signs.py - Modern sign classification → Citation metadata: loads citations
scripts/classify_modern_signs.py - Modern sign classification → LLM service: classifies mentions
scripts/classify_modern_signs.py - Headnote sign extraction → Signed citation graph: provides sign labels
scripts/build_signed_graph.py - Modern sign classification → Signed citation graph: provides sign labels
scripts/build_signed_graph.py - Citation metadata → Signed citation graph: provides citation edges
scripts/build_signed_graph.py - Signed citation graph → Graph scores: writes scores
scripts/build_signed_graph.py - Batch evaluation → Grounding library: runs extraction
scripts/run_evaluation_batch.py - Batch evaluation → Evaluation metrics: uses metrics
scripts/eval_lib.py - Baseline comparison → Evaluation metrics: uses metrics
scripts/run_baselines.py - Evaluation metrics → Grounding library: imports grounding
scripts/eval_lib.py - Evaluation metrics → IRAC verification: imports verifier
scripts/eval_lib.py - Batch evaluation → Evaluation results: writes summaries
scripts/run_evaluation_batch.py - Baseline comparison → Evaluation results: writes comparison
scripts/run_baselines.py