lexar
⚖️ Lexar: A Specialised NER Pipeline for Legal Texts
Lexar is an essential tool for legal tech and data science, providing a spaCy-based Named Entity Recognition (NER) pipeline specifically engineered to extract and classify structured legal information. Traditional NLP models often fail to recognise the nuanced and formal language of legal documents, but Lexar's rule-based engine provides reliable extraction across multiple legal domains.
Why Lexar?
- High Precision: Leverages sophisticated linguistic and regular expression patterns (rules) to achieve high precision on structured legal entities, avoiding the ambiguity of statistical models in this domain.
- Deep Legal Taxonomy: Recognises and labels over 12 specialised entity types critical to legal analysis.
- Seamless Integration: Designed as a standard spaCy component, making it easy to integrate into existing NLP or legal technology workflows.
🚀 Installation
Lexar is compatible with Python 3.8+ and uses standard spaCy dependencies.
# 1. Install the Lexar package from PyPI
pip install lexar
# 2. Install the required base spaCy language model
# Lexar uses this model for tokenisation and standard entities (like PERSON, ORG).
python -m spacy download en_core_web_sm
📖 Usage Example
To begin processing, load the custom NLP pipeline using the primary lexar.load() function and apply it to any legal text.
import lexar
# Load the custom legal NLP pipeline
nlp = lexar.load()
# Example text demonstrating multiple entity types defined in the pipeline
text = "The litigant filed Case No. 2025-CV-340 in the Supreme Court of the State of Texas, citing the GDPR. This matter was settled on the 15th day of October, 2025, and involved a Mortgage Deed."
doc = nlp(text)
print("\n--- Detected Legal Entities ---")
print("-" * 55)
# Iterate through all recognised entities in the document
for ent in doc.ents:
# Lexar extracts both custom legal entities and standard spaCy entities
print(f"| Label: {ent.label_.ljust(20)} | Text: {ent.text}")
# Expected Output (Illustrative):
# | Label: CASE_ID | Text: 2025-CV-340
# | Label: COURT_NAME | Text: Supreme Court
# | Label: JURISDICTION | Text: State of Texas
# | Label: ACT_STATUTE | Text: GDPR
# | Label: LEGAL_DATE | Text: 15th day of October, 2025
# | Label: DEED_TYPE | Text: Mortgage Deed
Metadata
Release files for lexar 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lexar-0.1.0.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lexar-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / lexar-0.1.0.tar.gz
| Download URL | lexar-0.1.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f55514d3e96157ca055ac4c17103b58fa3be15778f643540e1a10323fa7f35d0
|
|
BLAKE2b-256 checksum How to use checksums |
41b7076ba6c84c215ca8306da374f5ed09eac90bb75f193c902af7a4b7903263
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / lexar-0.1.0-py3-none-any.whl
| Download URL | lexar-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ded8740d4e4cd051f8e990415da958edec1d340dd6d75dbcec590a1a8f26d44d
|
|
BLAKE2b-256 checksum How to use checksums |
bfadb1fa1c9e0268b4128448ae19a2ec3f03962907ea62d21d982118a0c553b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|