Skip to main content

Micro-library to normalize text strings

Project description

normality

build

Normality is a Python micro-package that contains a small set of text normalization functions for easier re-use. These functions accept a snippet of unicode or utf-8 encoded text and remove various classes of characters, such as diacritics, punctuation etc. This is useful as a preparation to further text analysis.

WARNING: As of version 3.0, normality requires pyicu as a mandatory dependency. If you cannot install pyicu, consider using normality < 3.0.0.

Example

# coding: utf-8
from normality import normalize, slugify, collapse_spaces, ascii_text, latinize_text

text = normalize('Nie wieder "Grüne Süppchen" kochen!')
assert text == 'nie wieder grune suppchen kochen'

slug = slugify('My first blog post!')
assert slug == 'my-first-blog-post'

text = 'this \n\n\r\nhas\tlots of \nodd spacing.'
assert collapse_spaces(text) == 'this has lots of odd spacing.'

License

normality is open source, licensed under a standard MIT license (included in this repository as LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

normality-3.0.2-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file normality-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: normality-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for normality-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f013db2fdd831f26ae8b23f2e2652501ff0f9bdcb24d889ba5dc87c88a595288
MD5 47da1166cea47478739aba70a87827ca
BLAKE2b-256 d328779296044b38322463d1b0273f36e05b417410a4b66376879ca8bed227a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for normality-3.0.2-py3-none-any.whl:

Publisher: build.yml on pudo/normality

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page