Table of Contents
Fetching ...

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

Michael J Bommarito, Daniel Martin Katz, Jillian Bommarito

TL;DR

This work presents NUPunkt and CharBoundary, two open-source sentence boundary detection tools tailored for legal text at scale. NUPunkt extends the unsupervised Punkt approach with a comprehensive legal abbreviation knowledge base and KL3M-trained patterns, while CharBoundary uses supervised character-level features with adjustable precision-recall and multiple model sizes. Across five diverse legal datasets, the methods outperform general-purpose SBD tools in precision and balance, achieving up to $0.911$ precision for NUPunkt at ten million characters per second and up to $0.782$ F1 for CharBoundary with competitive throughput. The results demonstrate substantial reductions in context fragmentation within retrieval-augmented generation pipelines, enabling faster, more accurate legal document analysis on CPU-only hardware and providing practical, MIT-licensed tools for practitioners.

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.

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

TL;DR

This work presents NUPunkt and CharBoundary, two open-source sentence boundary detection tools tailored for legal text at scale. NUPunkt extends the unsupervised Punkt approach with a comprehensive legal abbreviation knowledge base and KL3M-trained patterns, while CharBoundary uses supervised character-level features with adjustable precision-recall and multiple model sizes. Across five diverse legal datasets, the methods outperform general-purpose SBD tools in precision and balance, achieving up to precision for NUPunkt at ten million characters per second and up to F1 for CharBoundary with competitive throughput. The results demonstrate substantial reductions in context fragmentation within retrieval-augmented generation pipelines, enabling faster, more accurate legal document analysis on CPU-only hardware and providing practical, MIT-licensed tools for practitioners.

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.

Paper Structure

This paper contains 37 sections, 5 figures, 6 tables.

Figures (5)

  • Figure 1: Error cascade in legal RAG pipelines from low-precision SBD to downstream reasoning failures.
  • Figure 2: Precision vs. recall comparison across models.
  • Figure 3: Precision comparison across models and datasets.
  • Figure 4: Recall comparison across models and datasets.
  • Figure 5: F1 score comparison across models and datasets.