normality
Micro-library to normalize text strings
What it is and what it does
Normality is a lightweight text-preprocessing library that applies a suite of Unicode normalization functions to prepare text for analysis. It removes diacritics (accents), punctuation, excess whitespace, and other character classes in a single pass, and can generate URL-safe slugs from arbitrary text. The package is built around a small set of composable functions—normalize, slugify, collapse_spaces, ascii_text, latinize_text—each handling a specific normalization task.
As of version 3.0, normality requires pyicu as a mandatory dependency, which brings full Unicode Collation Algorithm support but adds a system-level dependency. The package supports Python 3.10 through 3.13 and is actively maintained. It is useful as a preparation step for text analysis pipelines, search indexing, or any workflow where consistent text representation matters.
Use it for:
- Normalize user-supplied text before indexing into a search engine or database.
- Generate URL-safe slugs from article titles or user-generated content.
- Clean and deduplicate text fields by removing diacritics and punctuation before comparison.
- Preprocess multilingual text for downstream NLP or machine learning tasks.
- Collapse irregular whitespace in scraped or imported text data.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Normality removes diacritics, punctuation, and other character classes from Unicode text to prepare it for downstream analysis, offering functions like normalize, slugify, and collapse_spaces.
Yes. Normality is a mature, actively maintained library with no known vulnerabilities, low install friction, and a permissive MIT license. It solves a concrete text-preprocessing problem with a small, focused API. Install it if you need to normalize Unicode text; avoid it only if pyicu is unavailable in your environment and you cannot use an older version.
Install
normality on PyPI
pip
pip install normalityuv
uv add normalitypoetry
poetry add normalityInstalling normality
Before you install
Low friction install with a pure-Python wheel. Actively maintained as of 2026-03-08 with recent commits. Note: version 3.0 and later require pyicu as a mandatory dependency; if that is unavailable in your environment, consider pinning to normality < 3.0.0.
License in practice
MIT license (permissive). You may use, modify, and distribute normality freely in commercial and private projects, provided you retain the copyright notice and license text.
Quickstart
pip install normality
from normality import normalize, slugify
text = normalize('Nie wieder "Grüne Süppchen" kochen!')
slug = slugify('My first blog post!')
Requires Python 3.10 or later. Version 3.0+ requires pyicu, which may need system ICU libraries; if unavailable, use normality < 3.0.0.
Verify before relying
- Whether pyicu is available in your target deployment environment (it requires system ICU libraries on some platforms).
Package facts
| License | Copyright (c) 2013-2025, Friedrich Lindenberg, Gregor Aisch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — banal, chardet, charset-normalizer, pyicu |
| Maintenance | actively maintained — 159 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 294,758/month — #7,942 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: normality-3.1.0-py3-none-any.whl
Keywords: normalization, slugs, text, unicode
Tags
More Linguistic packages
Detects and normalizes text encoding from…
permissive · top 100 on PyPI
tiktokentiktoken is a fast BPE tokenizer that converts…
permissive · top 1,000 on PyPI
chardetDetects character encoding and language in byte…
permissive · top 1,000 on PyPI
text-unidecodeConverts Unicode text to ASCII by…
copyleft · top 1,000 on PyPI
larkLark is a parsing library that builds abstract…
permissive · top 1,000 on PyPI
tree-sitterPython bindings to the tree-sitter parsing…
permissive · top 1,000 on PyPI
procesProces provides text preprocessing functions…
permissive · top 15,000 on PyPI
python-slugifyConverts text strings—including unicode, HTML…
permissive · top 1,000 on PyPI
pyunormalizeProvides Unicode normalization (NFC, NFD, NFKC,…
permissive · top 5,000 on PyPI
zalgolibEncodes text with overlapping Unicode…
permissive · top 15,000 on PyPI
unicode-slugifyConverts strings into URL-friendly slugs while…
permissive · top 15,000 on PyPI
sacremosesSacremoses provides tokenization,…
permissive · top 5,000 on PyPI
bnunicodenormalizerNormalizes Bangla Unicode text by fixing…
permissive · top 15,000 on PyPI
slugifyConverts text strings into URL-safe slugs by…
unclear · top 15,000 on PyPI
anyasciiConverts Unicode text to ASCII-only equivalents…
permissive · top 5,000 on PyPI
PyArabicPyArabic provides functions to manipulate…
copyleft · top 15,000 on PyPI