Skip to content

antonvs88/neural-lex

Repository files navigation

neural-lex

neural-lex logo

neural-lex is a neuro-symbolic prototype for extracting legal rules from text and checking logical consistency with a SAT/SMT-style backend.

It is specifically tuned for Finnish traffic law (Tieliikennelaki 729/2018) using hierarchical decomposition and recursive querying inspired by Recursive Language Models.

Key Features

  • Hierarchical Extraction: Parses laws into sections and extracts normative logic atoms.
  • Recursive Reasoning: Resolves cross-references (§) between sections recursively.
  • Symbolic Verification: Detects pairwise conflicts and checks scenario satisfiability using Z3.
  • Agentic Extractor: Optional LLM-based recursive extraction layer (OpenAI/Gemini).

Quick Start

1. Installation

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,solver,llm]"

2. Run Consistency Check

# Run on an example excerpt
python -m neural_lex.cli --text-file examples/tll_ch2_excerpt.txt --chapter 2

3. Use Recursive LLM Extractor

python -m neural_lex.cli --text-file examples/tll_ch2_excerpt.txt --use-llm --gemini --google-key YOUR_KEY

Documentation

Testing

pytest

Note

This is a technical prototype and not legal advice.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages