neurosnap/sentences

A multilingual command line sentence tokenizer in Golang

What it solves

It provides a way to split a large block of text into individual sentences. This is particularly challenging because punctuation marks like periods are used both for sentence endings and in abbreviations, making simple splitting logic fail.

How it works

The project is a Go port of the NLTK Punkt tokenizer. It uses an unsupervised multilingual sentence boundary detection system that trains on text in a specific language to determine the likelihood that a word is an abbreviation, a collocation, or a sentence starter. It employs two phases of annotation (token-based and type-based analysis) to identify boundaries accurately.

Who it’s for

Developers who need a fast, zero-dependency sentence tokenizer for Go applications or as a command-line utility for text processing pipelines.

Highlights

  • Multilingual Support: Supports English, Czech, Dutch, Estonian, Finnish, German, Greek, Italian, Norwegian, Polish, Portuguese, Slovene, and Turkish.
  • High Performance: Faster than NLTK in processing speed while maintaining high accuracy (98.95% on the Brown Corpus).
  • Zero Dependencies: The library is lightweight and can be used as a CLI tool or integrated as a Go package.
  • Extendable: Built for composability, allowing developers to customize the tokenizer's behavior.

Related

  • Project
  • Project
  • Project
  • Project