PinyinBrailleConverter – Hanyu Pinyin to Braille


Conversion from Braille to Pinyin is ambiguous. The syllable pairs mo/me, e/o and le/lo will yield an AmbiguousConversionError. Furthermore conversion from Pinyin to Braille is lossy if tones are omitted, which seems to be frequent in writing Braille for Chinese. Braille doesn’t mark the fifth tone, so converting back to Pinyin will give syllables without a tone mark the fifth tone, changing originally unknown ones. See MandarinBrailleOperator.


Convert from Pinyin to Braille using the ReadingFactory:

>>> from cjklib.reading import ReadingFactory
>>> f = ReadingFactory()
>>> f.convert(u'Qǐng nǐ děng yīxià!', 'Pinyin', 'MandarinBraille',
...     targetOptions={'toneMarkType': 'None'})
u'\u2805\u2821 \u281d\u280a \u2819\u283c \u280a\u2813\u282b\u2830\u2802'

See also

How is Chinese written in Braille?
Chinese Braille
Article on Wikipedia


class cjklib.reading.converter.PinyinBrailleConverter(*args, **options)

Bases: cjklib.reading.converter.DialectSupportReadingConverter

PinyinBrailleConverter defines a converter between the Mandarin Chinese romanisation Hanyu Pinyin and the Braille system for Mandarin Chinese.

  • args – optional list of ReadingOperators to use for handling source and target readings.
  • options – extra options
  • dbConnectInst – instance of a DatabaseConnector, if none is given, default settings will be assumed.
  • sourceOperators – list of ReadingOperators used for handling source readings.
  • targetOperators – list of ReadingOperators used for handling target readings.
convertBasicEntity(entity, fromReading, toReading)

Converts a basic entity (a syllable) in the source reading to the given target reading.

This method is called by convertEntities() and a single entity is given for conversion.

If a single entity needs to be converted it is recommended to use convertEntities() instead. In the general case it can not be ensured that a mapping from one reading to another can be done by the simple conversion of a basic entity. One-to-many mappings are possible and there is no guarantee that any entity of a reading recognised by isReadingEntity() will be mapped here.

  • entity (str) – string written in the source reading in lower case letters
  • fromReading (str) – name of the source reading
  • toReading (str) – name of the target reading, different from the source reading
Return type:



the entity converted to the toReading in lower case

Raises AmbiguousConversionError:

if conversion for this entity of the source reading is ambiguous.

Raises ConversionError:

on other operations specific to the conversion of the entity.

Raises InvalidEntityError:

if the entity is invalid.

convertEntitySequence(entitySequence, fromReading, toReading)

Table Of Contents

Previous topic

PinyinIPAConverter — Hanyu Pinyin to IPA

Next topic

CantoneseYaleDialectConverter — Cantonese Yale dialects

This Page