GRDialectConverter – Gwoyeu Romatzyh dialects


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

Bases: cjklib.reading.converter.ReadingConverter

Provides a converter for different representations of the Chinese romanisation Gwoyeu Romatzyh.

  • 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.
  • keepGRApostrophes – if set to True apostrophes separating two syllables in Gwoyeu Romatzyh will be kept even if not necessary. Apostrophes missing before 0-initials will be added though.
  • breakUpAbbreviated – if set to 'on' abbreviated spellings will be converted to full entities, e.g. will be converted to, if set to 'auto' abbreviated forms are converted if the given target reading operator doesn’t support those forms, if set to 'off' abbreviated forms will always be conserved.


  • Impl: Strict mode for tone abbreviating spellings. Raise AmbiguousConversionError, e.g. raise on a which could be .a or a.
  • Impl: Add option to remove hyphens, “A Grammar of Spoken Chinese, p. xxii”, Conversion to Pinyin can use that.

Converts the abbreviated GR spellings to the full form. Non-abbreviated forms will returned unchanged. Takes care of capitalisation.

Multi-syllable forms may not be separated by whitespaces or other entities.

To also convert repetition markers run convertRepetitionMarker() first.

Parameter:readingEntities (list of str) – reading entities
Return type:list of str
Returns:full entities
Raises AmbiguousConversionError:
 if conversion is ambiguous.
convertEntities(readingEntities, fromReading='GR', toReading='GR')

Converts the repetition markers x and v to the full form they represent.

Parameter:readingEntities (list of str) – reading entities
Return type:list of str
Returns:reading entities with subsituted repetition markers
Raises ConversionError:
 if repetition markers x, v don’t follow a reading entity
classmethod getDefaultOptions()

Table Of Contents

Previous topic

PinyinWadeGilesConverter — Hanyu Pinyin to Wade-Giles

Next topic

GRPinyinConverter — Gwoyeu Romatzyh to Pinyin

This Page