{"id":8355,"library":"normality","title":"Normality","description":"Normality is a Python micro-package (current version 3.1.0) that provides a small set of text normalization functions for easier re-use. It accepts unicode or utf-8 encoded text and removes various classes of characters, such as diacritics and punctuation. This library is actively maintained and is useful as a preparation step for further text analysis.","status":"active","version":"3.1.0","language":"en","source_language":"en","source_url":"https://github.com/pudo/normality.git","tags":["text processing","text normalization","unicode","nlp"],"install":[{"cmd":"pip install normality","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Mandatory dependency for normality versions 3.0 and above, used for advanced unicode normalization.","package":"pyicu","optional":false}],"imports":[{"symbol":"normalize","correct":"from normality import normalize"},{"symbol":"slugify","correct":"from normality import slugify"},{"symbol":"collapse_spaces","correct":"from normality import collapse_spaces"},{"symbol":"ascii_text","correct":"from normality import ascii_text"},{"symbol":"latinize_text","correct":"from normality import latinize_text"}],"quickstart":{"code":"from normality import normalize, slugify, collapse_spaces\n\ntext = normalize('Nie wieder \"Grüne Süppchen\" kochen!')\nprint(f\"Normalized: {text}\")\n# Expected: nie wieder grune suppchen kochen\n\nslug = slugify('My first blog post!')\nprint(f\"Slugified: {slug}\")\n# Expected: my-first-blog-post\n\nspaced_text = 'this \\n\\n\\r\\nhas\\tlots of \\nodd spacing.'\ncleaned_text = collapse_spaces(spaced_text)\nprint(f\"Collapsed spaces: {cleaned_text}\")\n# Expected: this has lots of odd spacing.\n","lang":"python","description":"This quickstart demonstrates the core normalization functions of the `normality` library, including `normalize` for general text cleaning, `slugify` for creating URL-friendly slugs, and `collapse_spaces` for standardizing whitespace."},"warnings":[{"fix":"Ensure `pyicu` is installed in your environment (`pip install pyicu`) or downgrade to `normality==2.*`.","message":"As of version 3.0, `normality` requires `pyicu` as a mandatory dependency. If `pyicu` cannot be installed, users should revert to `normality < 3.0.0` to avoid `ImportError` or runtime issues.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Verify the intended purpose: `normality` (pudo/normality) for text, `scipy.stats.normaltest` (or similar) for statistical distribution testing.","message":"The `normality` library for text normalization is often confused with statistical 'normality tests' (e.g., Shapiro-Wilk, D'Agostino-Pearson, Anderson-Darling) found in libraries like SciPy (`scipy.stats.normaltest`). These are entirely different concepts; `normality` focuses on text string manipulation, not statistical analysis of data distributions.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the `pyicu` package: `pip install pyicu`.","cause":"The `pyicu` dependency, which is mandatory since `normality` version 3.0, is not installed in the environment.","error":"ImportError: No module named 'icu'"},{"fix":"If you intend to perform statistical normality tests, import from `scipy.stats`: `from scipy.stats import normaltest`. If you want text normalization, use functions like `normality.normalize()`.","cause":"`normality` is a text processing library, not a statistical library. Users are likely trying to call `scipy.stats.normaltest` mistakenly on the `normality` module.","error":"AttributeError: module 'normality' has no attribute 'normaltest'"}]}