tsroten / dragonmapper

Identification and conversion functions for Chinese text processing
MIT License
54 stars 18 forks source link

============= Dragon Mapper

.. image:: https://badge.fury.io/py/dragonmapper.svg :target: https://pypi.org/project/dragonmapper

.. image:: https://github.com/tsroten/dragonmapper/actions/workflows/ci.yml/badge.svg :target: https://github.com/tsroten/dragonmapper/actions/workflows/ci.yml

Dragon Mapper is a Python library that provides identification and conversion functions for Chinese text processing.

Features

.. code:: python

>>> s = '我是一个美国人。'
>>> dragonmapper.hanzi.is_simplified(s)
True
>>> dragonmapper.hanzi.to_pinyin(s)
'wǒshìyīgèměiguórén。'
>>> dragonmapper.hanzi.to_pinyin(s, all_readings=True)
'[wǒ][shì/shi/tí][yī][gè/ge/gě/gàn][měi][guó][rén/ren]。'

.. code:: python

>>> s = 'Wǒ shì yīgè měiguórén.'
>>> dragonmapper.transcriptions.is_pinyin(s)
True
>>> dragonmapper.transcriptions.pinyin_to_zhuyin(s)
'ㄨㄛˇ ㄕˋ ㄧ ㄍㄜˋ ㄇㄟˇ ㄍㄨㄛˊ ㄖㄣˊ.'
>>> dragonmapper.transcriptions.pinyin_to_ipa(s)
'wɔ˧˩˧ ʂɨ˥˩ i˥ kɤ˥˩ meɪ˧˩˧ kwɔ˧˥ ʐən˧˥.'

Getting Started