Legal Document Analyzer An AI-Powered Approach Using Semantic Search and Retrieval-Augmented Generation
Authors/Creators
Description
Legal documents such as contracts, rental agreements, policies, and rules and regulations often contain complex language that is difficult for ordinary users to understand. This paper presents a Legal Document Analyzer, an AI-powered web application designed to simplify legal document analysis through semantic search and Retrieval-Augmented Generation (RAG). The system extracts text from uploaded PDF documents and generates semantic embeddings using the intfloat/e5-base-v2 model. These embeddings are stored in ChromaDB, enabling efficient vector-based retrieval of relevant information. When a user submits a query, the system identifies and retrieves the most relevant clauses from the indexed documents and uses the retrieved context to generate accurate, context-aware responses. The application supports multiple document uploads, clause-level retrieval, and semantic search across different legal files. By providing relevant information in response to natural language queries, the proposed system reduces the effort required to search and understand lengthy legal documents. The system aims to improve the accessibility, efficiency, and transparency of legal information retrieval while preserving the original meaning and context of the source documents.
Files
Legal Document Analyzer.pdf
Additional details
References
- 1. P. Lewis et al., "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks," Advances in Neural Information Processing Systems, vol. 33, pp. 9459–9474, 2020.
- 2. N. Reimers and I. Gurevych, "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks," in Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pp. 3982–3992, 2019.
- 3. L. Wang et al., "Text Embeddings by Weakly-Supervised Contrastive Pre-training," arXiv preprint arXiv:2212.03533, 2022.
- 4. I. Chalkidis et al., "LEGAL-BERT: The Muppets Straight Out of Law School," in Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 2898–2904, 2020.
- 5. J. Johnson, M. Douze, and H. Jégou, "Billion-scale Similarity Search with GPUs," IEEE Transactions on Big Data, vol. 7, no. 3, pp. 535–547, 2019.
- 6. S. Robertson and H. Zaragoza, "The Probabilistic Relevance Framework: BM25 and Beyond," Foundations and Trends in Information Retrieval, vol. 3, no. 4, pp. 333–389, 2009.
- 7. A. Asai et al., "Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection," in International Conference on Learning Representations (ICLR), 2024.
- 8. Chroma, "Chroma Documentation: Vector Database for AI Applications." Available: https://docs.trychroma.com/
- 9. Hugging Face, "intfloat/e5-base-v2: Text Embeddings Model." Available: https://huggingface.co/intfloat/e5-base-v2
- 10. Apache Software Foundation, "Apache PDFBox Documentation." Available: https://pdfbox.apache.org/