Skip to main content

US-ASCII transliterations of Unicode text

Project description

Overview

GH-A: Tox tests Travis-CI AppVeyor Coverage Status PyPI version

ASCII transliterations of Unicode text that recognize CJKV complex characters.

Usage

You can run it on python3 interpreter:

from unihandecode import Unihandecoder
d = Unihandecoder(lang='zh')
print d.decode("\u660e\u5929\u660e\u5929\u7684\u98ce\u5439")
# That prints: Ming Tian Ming Tian De Feng Chui

u = Unihandecoder(lang='ja')
print d.decode('\u660e\u65e5\u306f\u660e\u65e5\u306e\u98a8\u304c\u5439\u304f')
# That prints: Ashita ha Ashita no Kaze ga Fuku

Description

It often happens that you have non-Roman text data in Unicode, but you can’t display it – usually because you’re trying to show it to a user via an application that doesn’t support Unicode, or because the fonts you need aren’t accessible. You could represent the Unicode characters as “???????” or “15BA15A01610…”, but that’s nearly useless to the user who actually wants to read what the text says.

What Unihandecode provides is a function, ‘decode(…)’ that takes Unicode data and tries to represent it in ASCII characters (i.e., the universally displayable characters between 0x00 and 0x7F). The representation is almost always an attempt at transliteration – i.e., conveying, in Roman letters, the pronunciation expressed by the text in some other writing system. (See the example above)

These are same meaning in both language in example above. “明天明天的风吹” for Chinese and “明日は明日の風が吹く” for Japanese. The character “明” is converted “Ming” in Chinese. “明日” is converted “Ashita” but single charactor “明” will be converted “Mei” in Japanese.

This can be considered as an improved version of Python unidecode. unidecode is Python port of Text::Unidecode Perl module by Sean M. Burke <sburke@cpan.org>.

Requirements

It use a setuptools library to build and test.

Installation

You can install Unihandecode as usual

$ pip install unihandecode

Build

You can build Unihandecode in recent way

$ python -m pep517.build ./

Test

You can run unit, lint, integration and regression tests with tox

$ tox

You can also run tests with launch pytest. To run pytest on project root, please set PYTHONPATH to ‘<project_root>/src/’. It helps debugger to diagnose problems.

$ pytest -vv

To launch lint test such as flake8;

$ tox -e check

SUPPORT

Questions, bug reports, useful code bits, and suggestions for Unihandecode are handled on github project page.

AVAILABILITY

The latest version of Unihandecode is available from Git repository in github.com:

https://github.com/miurahr/unihandecode

and Eggs are on PyPi.python.org:

https://pypi.python.org/pypi/Unihandecode

LICENSE

Unihandecode

Copyright 2010-2018,2020 Hiroshi Miura

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Bitdeli

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

unihandecode-0.9a3.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

unihandecode-0.9a3-py2.py3-none-any.whl (3.6 MB view details)

Uploaded Python 2Python 3

File details

Details for the file unihandecode-0.9a3.tar.gz.

File metadata

  • Download URL: unihandecode-0.9a3.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for unihandecode-0.9a3.tar.gz
Algorithm Hash digest
SHA256 775e3b1524d2aa54806da2fa267cefc715d5abd522f349b98f1a65aa26cd6cea
MD5 23aabaaecc9b1b4eec4e87736f24d9dc
BLAKE2b-256 de2a1e1e76701464d2f7678c33b2dc8f2419191efd58341f32ae355dbdccccc8

See more details on using hashes here.

File details

Details for the file unihandecode-0.9a3-py2.py3-none-any.whl.

File metadata

  • Download URL: unihandecode-0.9a3-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for unihandecode-0.9a3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bc8f3409b6f8c524a0d21fc1ac7fd8aaf2784ef5f40181fdb11d484c5422ba52
MD5 87217a86bdb255ab7948e0bc8d769c32
BLAKE2b-256 6ded0ca67ce5c2bca640abd76a5c5ce01e5fc9e55fb818e5f37b8fac69ac35c8

See more details on using hashes here.

Supported by

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