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.1.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: normality-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 850419eb8cbc43c79afe005b93155cf41c5dd26c7d6e2a0aa6452f3210c0b338
MD5 e3f7ffc8ba552c218d6c0281f6b132d0
BLAKE2b-256 76e36da3194df038e2476cf9384f807c8f0c486b579f54799458f238c2d2d8da

See more details on using hashes here.

Provenance

The following attestation bundles were made for normality-3.1.0-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