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

Class EntityWiseReadingConverter

source code


Defines an abstract ReadingConverter between two or more readingss for doing entity wise conversion.

Converters that simply convert one syllable at once can implement this class and merely need to overwrite convertBasicEntity()

Instance Methods [hide private]
list of str
convertEntities(self, readingEntities, fromReading, toReading)
Converts a list of entities in the source reading to the given target reading.
source code
str
convertBasicEntity(self, entity, fromReading, toReading)
Converts a basic entity (e.g.
source code

Inherited from ReadingConverter: __init__, 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]

Inherited from ReadingConverter: getDefaultOptions

Class Variables [hide private]

Inherited from ReadingConverter: CONVERSION_DIRECTIONS

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

convertEntities(self, readingEntities, fromReading, toReading)

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)

convertBasicEntity(self, entity, fromReading, toReading)

source code 

Converts a basic entity (e.g. 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.

The default implementation will raise a NotImplementedError.

Parameters:
  • entity (str) - string written in the source reading
  • fromReading (str) - name of the source reading
  • toReading (str) - name of the target reading
Returns: str
the entity converted to the toReading
Raises: