Registry / serialization / text-unidecode

text-unidecode

JSON →
library1.3pypypi✓ verified 30d ago

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.

pip install text-unidecode
INSTALL
IMPORT
SIG · TEXT-UNIDECODE
T
text-unidecode
serializationpythonv1.3
Install
1.7s avg
Import
40ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.040s · 18.1MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.040s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

unidecode
✓ from text_unidecode import unidecode

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}")
Debug
Known issues
gotchatext-unidecode performs basic, context-free character-by-character transliteration. This can lead to inaccurate or unexpected results for languages with complex writing systems (e.g., Japanese, Thai) or for characters with language-specific transliteration conventions (e.g., German umlauts, which are mapped to 'A', 'O', 'U' instead of 'Ae', 'Oe', 'Ue'). It's not designed for high-quality, language-aware transliteration.
fix
For critical applications, evaluate the output carefully or pre-process strings for specific language rules. For better transliteration quality, consider language-specific libraries or the alternative 'unidecode' package if its license is acceptable.
affects: All versions
breakingThe transliteration tables within the library can be updated in future versions to improve mappings or fix inconsistencies. This means that the ASCII output for a given Unicode input might change between versions, potentially breaking systems that rely on consistent, stable ASCII representations (e.g., for generating unique URL slugs or identifiers).
fix
If output stability is crucial (e.g., for URL slugs), either store the generated ASCII string in a database or pin the 'text-unidecode' dependency to a specific version to prevent unexpected changes.
affects: All versions, especially across major updates (though this library is stable, the underlying principle applies)
gotchaThe `text-unidecode` project's own documentation suggests an alternative library, `unidecode`, which is also a port of Text::Unidecode. It states that `unidecode` offers 'better memory usage and better transliteration quality' but is GPL-licensed. Users should evaluate `unidecode` if their project is compatible with GPL and requires potentially superior results.
fix
Review project licensing requirements and compare `text-unidecode` with the `unidecode` library to choose the best fit for quality and license compatibility.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'unidecode'
The `text-unidecode` Python package, which provides the `unidecode` module, has not been installed in the current Python environment.
fix
pip install text-unidecode
TypeError: 'module' object is not callable
After `import unidecode`, the user is trying to call the entire module as a function instead of accessing the specific `unidecode` function within it.
fix
Use `unidecode.unidecode('your text')` or import the function directly with `from unidecode import unidecode` and then call `unidecode('your text')`.
ModuleNotFoundError: No module named 'text_unidecode'
The user is attempting to import a module named `text_unidecode`, but the actual module name provided by the `text-unidecode` package is `unidecode`.
fix
Use the correct module name in your import statement: `from unidecode import unidecode` or `import unidecode`.
NameError: name 'unidecode' is not defined
The `unidecode` function was called without being imported first from the `unidecode` module.
fix
Import the function before using it: `from unidecode import unidecode`
Upgrade
Version history
1.3latest on PyPI · released Aug 30, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
text-unidecode — pip install text-unidecode · libregistry