Package cjklib :: Package reading :: Module converter
[hide private]
[frames] | no frames]

Module converter

source code

Provides ReadingConverters, classes to convert strings written in a character reading to another reading.

Examples

Convert a string from Jyutping to Cantonese Yale:

>>> from cjklib.reading import ReadingFactory
>>> f = ReadingFactory()
>>> f.convert('gwong2jau1wa2', 'Jyutping', 'CantoneseYale')
u'gwóngyāuwá'

This is also possible creating a converter instance explicitly using the factory:

>>> jyc = f.createReadingConverter('GR', 'Pinyin')
>>> jyc.convert('Woo.men tingshuo yeou "Yinnduhshyue", "Aijyishyue"')
u'Wǒmen tīngshuō yǒu "Yìndùxué", "Āijíxué"'

Convert between different dialects of the same reading Wade-Giles:

>>> f.convert(u'kuo3-yü2', 'WadeGiles', 'WadeGiles',
...     sourceOptions={'toneMarkType': 'Numbers'},
...     targetOptions={'toneMarkType': 'SuperscriptNumbers'})
u'kuo³-yü²'

See PinyinDialectConverter for more examples.

Classes [hide private]
  ReadingConverter
Defines an abstract converter between two or more character readings.
  EntityWiseReadingConverter
Defines an abstract ReadingConverter between two or more readingss for doing entity wise conversion.
  RomanisationConverter
Defines an abstract ReadingConverter between two or more romanisations.
  PinyinDialectConverter
Provides a converter for different representations of the Chinese romanisation Hanyu Pinyin.
  WadeGilesDialectConverter
Provides a converter for different representations of the Mandarin Chinese romanisation Wade-Giles.
  PinyinWadeGilesConverter
Provides a converter between the Chinese romanisation Hanyu Pinyin and Wade-Giles.
  GRDialectConverter
Provides a converter for different representations of the Chinese romanisation Gwoyeu Romatzyh.
  GRPinyinConverter
Provides a converter between the Chinese romanisation Gwoyeu Romatzyh and Hanyu Pinyin.
  PinyinIPAConverter
Provides a converter between the Mandarin Chinese romanisation Hanyu Pinyin and the International Phonetic Alphabet (IPA) for Standard Mandarin.
  PinyinBrailleConverter
PinyinBrailleConverter defines a converter between the Chinese romanisation Hanyu Pinyin (with tone marks as numbers) and the Braille system for Mandarin.
  JyutpingDialectConverter
Provides a converter for different representations of the Cantonese romanisation Jyutping.
  CantoneseYaleDialectConverter
Provides a converter for different representations of the Cantonese Yale romanisation system.
  JyutpingYaleConverter
Provides a converter between the Cantonese romanisation systems Jyutping and Cantonese Yale.
  BridgeConverter
Provides a ReadingConverter that converts between readings over a third reading called bridge reading.