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: This library works much better when used in combination with pyicu, a Python binding for the International Components for Unicode C library. ICU provides much better text transliteration than the default text-unidecode.

Example

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

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 Distribution

normality-2.3.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

normality-2.3.1-py2.py3-none-any.whl (12.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file normality-2.3.1.tar.gz.

File metadata

  • Download URL: normality-2.3.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for normality-2.3.1.tar.gz
Algorithm Hash digest
SHA256 a9f2b5dca05dc41bffeeea2a32194f68ff391ca10715bdd2f6914c7f781fe533
MD5 bd78833fb45aa7ba4f6086ea9fd27e2c
BLAKE2b-256 ac1d6ebbaff72c7c6472a6a8bad5d4fd85cbda41456219ba290077f64f975ce7

See more details on using hashes here.

File details

Details for the file normality-2.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: normality-2.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for normality-2.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2c717633c8f147d9b8331229a879f6c598c0d135e041562b9d9ca3d7b26f85d9
MD5 77e73f1ca16fb9f509695fef3c2b6c0c
BLAKE2b-256 c4af189b33e4b554e4f84f4d0c8e0ade4c9eaa5b18c298db3f2420289245e2f5

See more details on using hashes here.

Supported by

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