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

Class GRDialectConverter

source code


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

Instance Methods [hide private]
 
__init__(self, *args, **options)
Creates an instance of the GRDialectConverter.
source code
list of str
convertEntities(self, readingEntities, fromReading='GR', toReading='GR')
Converts a list of entities in the source reading to the given target reading.
source code

Inherited from ReadingConverter: convert, getOption

Inherited from ReadingConverter (private): _getFromOperator, _getToOperator

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods [hide private]
dict
getDefaultOptions(cls)
Returns the reading converter's default options.
source code
Class Variables [hide private]
  CONVERSION_DIRECTIONS = [('GR', 'GR')]
List of tuples for specifying supported conversion directions from reading A to reading B.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **options)
(Constructor)

source code 

Creates an instance of the GRDialectConverter.

Parameters:
  • args - optional list of RomanisationOperators 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.
Overrides: object.__init__

getDefaultOptions(cls)
Class Method

source code 

Returns the reading converter's default options.

The keyword 'dbConnectInst' is not regarded a configuration option of the converter and is thus not included in the dict returned.

Returns: dict
the reading converter's default options.
Overrides: ReadingConverter.getDefaultOptions
(inherited documentation)

convertEntities(self, readingEntities, fromReading='GR', toReading='GR')

source code 

Converts a list of entities in the source reading to the given target reading.

The default implementation will raise a NotImplementedError.

Parameters:
  • readingEntities - list of entities written in source reading
  • fromReading - name of the source reading
  • toReading - name of the target reading
Returns: list of str
list of entities written in target reading
Raises:
  • ConversionError - on operations specific to the conversion between the two readings (e.g. error on converting entities).
  • UnsupportedError - if source or target reading is not supported for conversion.
  • InvalidEntityError - if an invalid entity is given.
Overrides: ReadingConverter.convertEntities
(inherited documentation)