text-unidecode

1.3 · active · verified Sat Mar 28

text-unidecode is a basic and lightweight Python port of the Perl Text::Unidecode library. It converts Unicode text into a 'good enough' 7-bit ASCII representation by performing context-free, character-by-character transliteration. The current version is 1.3, released in 2019, indicating a stable but infrequently updated project.

Warnings

Install

Imports

Quickstart

Demonstrates how to import the `unidecode` function and use it to transliterate a Unicode string into a basic ASCII equivalent.

from text_unidecode import unidecode

unicode_text = "Héllø Wörld! Како си? 北亰"
ascii_text = unidecode(unicode_text)

print(f"Original: {unicode_text}")
print(f"ASCII: {ascii_text}")

# Example with specific characters
unicode_german = "Äpfel, Öfen, Übermut"
ascii_german = unidecode(unicode_german)
print(f"German Original: {unicode_german}")
print(f"German ASCII: {ascii_german}")

view raw JSON →