skillfed

uniseg

Determine Unicode text segmentations

uniseg v0.10.1 98.4K downloads/30d#13,089 on PyPI
Permissive license AGING released

What it is and what it does

uniseg is a pure-Python library for determining Unicode text segmentation boundaries according to the Unicode Standard. It provides functions to identify grapheme cluster boundaries (user-perceived characters that may span multiple code points), word breaks, sentence breaks, and line break opportunities. The package also includes text-wrapping classes for both monospace (console) and proportional (graphical) font environments, making it useful for applications that need to handle text layout and display correctly across different writing systems.

The library implements the Unicode Standard Annex rules for text segmentation without requiring external C libraries or dictionaries. This makes it more portable than alternatives like PyICU, though potentially slower. It supports current Python versions (3.9 through 3.13) and recently achieved a milestone by passing all Unicode breaking tests in version 0.9.0, indicating improved correctness for edge cases.

Use it for:

  • Implement proper text wrapping in CLI tools that must respect Unicode line-breaking rules across different scripts.
  • Build text editors or word processors that need to identify grapheme cluster boundaries for cursor positioning and text selection.
  • Process multilingual text to find word boundaries without relying on language-specific dictionaries.
  • Format console output with correct line breaks for Unicode strings containing combining characters or emoji.
  • Analyze or segment Unicode text in natural language processing pipelines that require Unicode-aware boundaries.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Determines Unicode text segmentation boundaries—grapheme clusters, words, sentences, and line breaks—using Unicode Standard Annex rules, and provides text wrapping for console and graphical environments.

Yes, if you need Unicode-aware text segmentation in pure Python. The package is stable, has no dependencies, and recently achieved full Unicode test compliance. Install friction is minimal. The aging maintenance status (217 days since last release) is a minor concern for a mature library, but the recent test milestone and current Python version support suggest active stewardship. Avoid if you need maximum performance—PyICU is faster but requires compilation and external libraries.

Install

uniseg on PyPI

pip

pip install uniseg

uv

uv add uniseg

poetry

poetry add uniseg

Installing uniseg

Before you install

Low install friction; pure Python with no runtime dependencies. Maintenance status is aging—last release was 217 days ago—but the package recently passed all Unicode breaking tests and supports current Python versions (3.9+).

License in practice

Licensed under MIT (permissive), imposing no restrictions on use, modification, or distribution.

Quickstart

pip install uniseg

import uniseg.graphemecluster
import uniseg.wordbreak
import uniseg.linebreak

for cluster in uniseg.graphemecluster.graphemeclusters('café'):
    print(cluster)

for word in uniseg.wordbreak.words('hello world'):
    print(word)

Requires Python 3.9 or later.

Verify before relying

  • Performance characteristics compared to PyICU or other segmentation libraries for large-scale text processing.
  • Whether the package's rule-based grapheme cluster segmentation (reintroduced in 0.9.0) handles all modern Unicode combining sequences correctly.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 217 days since the last release
First released
Downloads 98,360/month — #13,089 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: uniseg-0.10.1-py3-none-any.whl

Keywords: text, unicode

Development Status :: 4 - BetaLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Text Processing

Tags

unicode text segmentationgrapheme cluster boundariesword break detectionline breaking algorithmunicode-aware text wrappingsentence boundary detectionunicode text processing
unicodetext-segmentationinternationalization

More Text Processing packages