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
Bases: cjklib.reading.converter.DialectSupportReadingConverter
PinyinBrailleConverter defines a converter between the Mandarin Chinese romanisation Hanyu Pinyin and the Braille system for Mandarin Chinese.
Parameters: |
|
---|
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.
Parameters: |
|
---|---|
Return type: | str |
Returns: | 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. |