Skip to main content

Python library to "translate" a variety of unicode special characters to normal text

Project description

uni-translate

Python library to "translate" a variety of unicode special characters to normal text

can be used as a command line util for strings and text files, or as a library for easier and more flexible integration


Lib Examples:

examples can be found in the /examples directory

Lib Documentation:

  • [class] translator

    • [kwarg] Union[dict, List[str]]=None key:

      • key used to contruct a translation table, can be a list of strings contaning 52 characters (one for each letter, upper and lowercase), or a dict contaning key/value pairs that map each character in the key to a character in the value. (default is provided)


    • [kwarg] Union[str, List[str]]=None remove:

      • characters to be stripped during translation (default is provided)


    • [kwarg] (bool)=False debug:

      • toggles debug prints in the __init__


    • [method] translate -> str:

      • [arg] (str) text: text to be translated


    • [method] text_to_unicode -> str:

      • [arg] (str) text: text to be translated

      • [kwarg] (int) mode: translation mode to use, this should correspond to an index in the key


    • [staticmethod] _trans -> str:

      • method to translate text via the given table

      • [arg] (str) text: text to be translated

      • [arg] Union[dict, Union[List[str], Tuple[str]]] table: table to use for translation, when a list or tuple is passed, the first element is treated as the key and the second element is treated as the value. dict should only be passed if it is a valid translation table (as obtained from str.maketrans)


    • [staticmethod] clean_key -> Tuple[str]:

      • returns the key cleaned of "normal" characters and duplicates, and its respective alphabet value

      • [arg] (str) key - key to be cleaned


Command line:

  • uni-translate -t #unicode here

  • paths to text files can be passed aswell, if nothing is passed the user will be prompted

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

uni-translate-0.0.5.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

uni_translate-0.0.5-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file uni-translate-0.0.5.tar.gz.

File metadata

  • Download URL: uni-translate-0.0.5.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.7

File hashes

Hashes for uni-translate-0.0.5.tar.gz
Algorithm Hash digest
SHA256 acc5dd0ad171b6dcaf13a3ee46bdce8152d6dd4f5f6a7deaa81849e07e489627
MD5 301ed5e69dc1401be12b5e434a56d55c
BLAKE2b-256 7cd08cedfc6f518528a2eb5cc556ca1e9bc0a07feeaf71e162d31cffeab040e4

See more details on using hashes here.

File details

Details for the file uni_translate-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: uni_translate-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.7

File hashes

Hashes for uni_translate-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8a1c8dd3258c827fdbdddf671ac67101d4ff7c326bfff47e204713ffc41f7f5a
MD5 aafd4fc20b5120261d2fca6a6a30757b
BLAKE2b-256 506953ffec59a26d173333ab31f23bac7f49ddeed2f238fef4ae3beb1539a9a4

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