Precise Legal Sentence Boundary Detection for Retrieval at Scale: NUPunkt and CharBoundary

Michael J. Bommarito II, Daniel Martin Katz, Jillian Bommarito · 2025

Read Precise Legal Sentence Boundary Detection for Retrieval at Scale: NUPunkt and CharBoundary by Michael J. Bommarito II, Daniel Martin Katz, Jillian Bommarito (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-04131.txt.

Introduction

Michael Bommarito and co-authors build tools that split legal text into sentences in a 2025 paper. Legal files bristle with citations, short forms, and tangled syntax that trip general purpose splitters. Clean splits matter for search, due diligence, and discovery work at scale.

Two libraries result: NUPunkt, a pure Python tool with no outside needs, and CharBoundary, a model based tool with a tunable trade of precision and recall. On five legal sets with near two hundred thousand marked splits, NUPunkt hit high precision while chewing ten million characters a second. Both run on plain CPUs under a free license.

Catalog record

CREATORMichael J. Bommarito II, Daniel Martin Katz, Jillian Bommarito
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE35 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2504-04131

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Precise Legal Sentence Boundary Detection for Retrieval at Scale: NUPunkt and CharBoundary Thanks: Email: [email protected] Michael J. Bommarito II, Daniel Martin Katz, Jillian Bommarito Abstract We present NUPunkt and CharBoundary, two sentence boundary detection libraries optimized for high-precision, high-throughput processing of legal text in large-scale applications such as due diligence, e-discovery, and legal research. These libraries address the critical challenges posed by legal documents containing specialized citations, abbreviations, and complex sentence structures that confound general-purpose sentence boundary detectors. Our experimental evaluation on five diverse legal datasets comprising over 25,000 documents and 197,000 annotated sentence boundaries demonstrates that NUPunkt achieves 91.1% precision while processing 10 million characters per second with modest memory requirements (432 MB). CharBoundary models offer balanced and adjustable precision-recall tradeoffs, with the large model achieving the highest F1 score (0.782) among all tested methods. Notably, NUPunkt provides a 29-32% precision improvement over general-purpose tools while maintaining exceptional throughput, processing multi-million document collections in minutes rather than hours. Both libraries run efficiently on standard CPU hardware without requiring specialized accelerators. NUPunkt is implemented in pure Python with zero external dependencies, while CharBoundary relies only on scikit-learn and optional ONNX runtime integration for optimized performance. Both libraries are available under the MIT license, can be installed via PyPI, and can be interactively tested at https://sentences.aleainstitute.ai/ . These libraries address critical precision issues in retrieval-augmented generation systems by preserving coherent legal concepts across sentences, where each percentage improvement in precision yields exponentially greater reductions in context fragmentation, creating cascading benefits throughout retrieval pipelines and significantly enhancing downstream reasoning quality. I Introduction Accurate sentence boundary detection (SBD) forms the foundation of natural language processing pipelines, [ 1 , 2 , 3 , 4 , 5 ] including for large-scale legal applications such as M&A due diligence, contract review, and legal research. While considered largely solved for general text, legal documents present unique challenges that cause standard SBD approaches to fail in critical ways. Legal text contains domain-specific patterns that confound general-purpose sentence boundary detectors: legal citations (e.g., United States v. Carroll Towing Co. , 159 F.2d 169 (2d Cir. 1947)); specialized abbreviations (e.g., “Corp.”, “Inc.”, “U.S.C.”); legal sources (e.g., “Harv. L. Rev.”); numbered lists; and complex sentence structures. These features cause standard SBD tools to incorrectly split sentences or miss boundaries altogether, fundamentally compromising downstream legal analysis tasks. Retrieval-augmented generation (RAG) systems are increasingly used in the legal domain. [ 6 , 7 , 8 , 9 ] False positives are especially detrimental in such RAG style systems, as they fragment logically connected legal concepts across multiple chunks, leading to reasoning failures. As illustrated in Figure 1 , the relationship between precision and fragmentation follows an inverse exponential curve, where each percentage point improvement in precision yields progressively greater reductions in fragmentation errors. This non-linear effect occurs because each correctly preserved sentence boundary prevents multiple downstream failures throughout the RAG pipeline. Fig. 1 : Error cascade in legal RAG pipelines from low-precision SBD to downstream reasoning failures. Beyond RAG workflows, accurate high-throughput processing is also crucial for legal applications involving very large bodies of documents. High-throughput processing, however, starts with the faithful processing and representation of legal texts. For example, when processing “Employee’s Annual Bonus shall be calculated pursuant to Sec. 4.3(c), subject to the limitations of I.R.C. § 409A(a)(2)(B)(i) and the withholding requirements of Sec. 7.3,” a standard SBD system incorrectly splits after “Sec. 4.3”, creating multiple fragments. When queried about bonus calculation rules, a RAG system would retrieve only partial information, missing critical context about the IRC §409A tax code limitations that affect deferred compensation. In this paper, we introduce two new open-source SBD libraries optimized for high-precision, high-throughput processing of legal text: • NUPunkt : A pure Python implementation that extends the unsupervised Punkt algorithm by Kiss and Strunk [ 10 ] with legal domain optimizations and training on the significantly larger KL3M legal corpus [ 11 ] . NUPunkt achieves 91.1% precision while processing 10 million characters per second with modest memory requirements (432 MB), providing a 29-32% precision improvement over standard tools like NLTK Punkt (62.1%) and spaCy (64.3-64.7%), with zero external dependencies and MIT licensing. • CharBoundary : A family of character-level machine learning models, inspired by character-based approaches like Sanchez [ 12 ] but trained on substantially more diverse legal text, in three sizes (small, medium, large) that offer balanced precision-recall tradeoffs. The large model achieves the highest F1 score (0.782) among all tested methods, with throughput ranging from 518K-748K characters per second depending on model size. CharBoundary requires only scikit-learn and optional ONNX runtime integration, and is also available under the MIT license. Our experimental evaluation on five diverse legal datasets comprising over 25,000 documents and 197,000 annotated sentence boundaries demonstrates that both libraries significantly outperform general-purpose alternatives. NUPunkt excels in precision-critical applications where minimizing false positives is paramount, enabling processing of multi-million document collections in minutes rather than hours. CharBoundary models provide the best overall F1 scores with excellent balance between precision and recall, making them suitable for applications requiring more nuanced boundary detection. Our contributions include: (1) two open-source SBD libraries optimized for legal text with specific focus on precision and throughput; (2) a comprehensive benchmark of sentence boundary detection performance across diverse legal datasets; and (3) detailed analysis of precision-throughput tradeoffs for legal text processing applications. Both libraries are freely available under the MIT license, with interactive demonstrations at https://sentences.aleainstitute.ai/ . All source code to replicate this paper’s experiments will be available at https://github.com/alea-institute/legal-sentence-paper . II Related Work II-A Sentence Boundary Detection Methods Sentence boundary detection approaches can be categorized into rule-based methods and machine learning approaches. NLTK’s punkt tokenizer [ 10 ] uses unsupervised learning with collocation detection for abbreviations, while modern systems like spaCy [ 13 ] and pySBD [ 14 ] implement both statistical and neural approaches. Deep learning methods using BiLSTMs and transformers [ 15 ] represent recent advances, though with higher computational requirements. II-B Legal Text Processing Challenges Legal text introduces unique challenges due to domain-specific structures including citations (e.g., United States v. Carroll Towing Co. , 159 F.2d 169 (2d Cir. 1947)), specialized abbreviations, and hierarchical formatting. Sanchez [ 12 ] found general-purpose SBD methods suffer accuracy reductions in legal text. These failures have cascading impacts on downstream legal NLP tasks such as information extraction [ 16 ] , document classification [ 17 ] , and named entity recognition [ 18 ] . II-C Domain-Adapted SBD for Legal Text Previous work on specialized legal SBD includes Savelka et al. [ 19 ] , who achieved 96% F1-score using CRF models on legal decisions. Sheik et al. [ 20 ] found CNN-based approaches offered the best balance of performance (97.7% F1) and efficiency, outperforming even transformer models while operating 80 times faster than CRF approaches. Most recently, Brugger et al. [ 21 ] introduced MultiLegalSBD with over 130,000 annotated sentences across six languages. II-D Limitations of Current Approaches Despite these advances, existing methods face notable constraints. Most methods tend to compromise either accuracy or efficiency, often demanding considerable computational resources or extensive feature engineering. Additionally, there is limited exploration of precision/recall tradeoffs, with the majority of techniques prioritizing F1-score maximization over the precision essential for retrieval-augmented

Read the complete text