GRDialectConverter – Gwoyeu Romatzyh dialects

Class

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

Bases: cjklib.reading.converter.ReadingConverter

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

Parameters:
  • 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. sherm.me will be converted to shern.me, 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.

Todo

  • 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.
convertAbbreviatedEntities(readingEntities)

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')
convertRepetitionMarker(readingEntities)

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