ClauseGuard / README.md
gaurv007's picture
Upload README.md
e8d10a0 verified
|
raw
history blame
2.77 kB
---
title: ClauseGuard
emoji: πŸ›‘οΈ
colorFrom: gray
colorTo: gray
sdk: gradio
sdk_version: "5.23.0"
python_version: "3.12"
app_file: app.py
pinned: false
---
# πŸ›‘οΈ ClauseGuard β€” AI Contract Analysis
**The world's most comprehensive open-source legal contract analysis tool.**
ClauseGuard automatically analyzes legal contracts using state-of-the-art NLP models fine-tuned on legal data.
## ✨ Features
### Core Analysis
- **41 CUAD Clause Categories** β€” Detects and classifies clauses across the full [CUAD](https://huggingface.co/datasets/theatticusproject/cuad-qa) taxonomy (Document Name, Parties, Governing Law, Indemnification, Termination, Non-Compete, IP Ownership, etc.)
- **4-Tier Risk Scoring** β€” Critical / High / Medium / Low with visual risk matrix
- **Legal NER** β€” Extracts parties, dates, monetary values, jurisdictions, defined terms
- **NLI Contradiction Detection** β€” Identifies conflicting clauses and missing critical provisions
- **PDF / DOCX / TXT Support** β€” Upload any contract format
### UI/UX
- **3-Panel Professional Layout** β€” Sidebar upload + Main analysis + Summary dashboard
- **Document Viewer** β€” Text with inline entity highlights
- **Clause Cards** β€” Expandable cards with risk badges and descriptions
- **Export Reports** β€” JSON (structured data) and CSV (tabular) downloads
- **Color-Coded Risk Badges** β€” Visual indicators for quick triage
## 🧠 Models Used
| Component | Model |
|-----------|-------|
| Clause Classification | `Mokshith31/legalbert-contract-clause-classification` (LoRA on `nlpaueb/legal-bert-base-uncased`) |
| Fallback Detection | Regex patterns covering 15+ clause types |
| NER | Rule-based with 7 entity types (dates, money, parties, jurisdictions, defined terms) |
| NLI | Heuristic contradiction detection across 5 conflict patterns |
## πŸ“š Datasets
- [CUAD](https://huggingface.co/datasets/theatticusproject/cuad-qa) β€” 510 contracts, 13K annotations, 41 clause categories
- [LegalBench](https://huggingface.co/datasets/nguha/legalbench) β€” 322 legal reasoning tasks
- [LexGLUE](https://huggingface.co/datasets/coastalcph/lex_glue) β€” Unfair Terms of Service classification
## πŸš€ Usage
1. Upload a contract (PDF, DOCX, or TXT) or paste text directly
2. Click **Analyze Contract**
3. View results across tabs: Document, Clauses, Entities, Contradictions
4. Download JSON/CSV reports
## ⚠️ Disclaimer
*Not legal advice. ClauseGuard is an AI-powered analysis tool for informational purposes only. Always consult a qualified attorney for legal decisions.*
## πŸ”— Links
- [Space](https://huggingface.co/spaces/gaurv007/ClauseGuard)
- [CUAD Paper](https://arxiv.org/abs/2103.06268)
- [LegalBench](https://huggingface.co/datasets/nguha/legalbench)