Package cjklib :: Package reading :: Module operator :: Class TonalRomanisationOperator
[hide private]
[frames] | no frames]

Class TonalRomanisationOperator

source code


Provides an abstract RomanisationOperator for tonal languages incorporating methods from TonalFixedEntityOperator.

It provides two methods getTonalEntity() and splitEntityTone() to cope with tonal information in text.

The class itself can't be used directly, it has to be subclassed and its methods need to be extended.

Instance Methods [hide private]
 
__init__(self, **options)
Creates an instance of the TonalRomanisationOperator.
source code
list of str
getReadingEntities(self)
Gets a set of all entities supported by the reading.
source code
bool
isPlainReadingEntity(self, entity)
Returns true if the given plain entity (without any tone mark) is recognised by the romanisation operator, i.e.
source code
bool
isReadingEntity(self, entity)
Returns true if the given entity is recognised by the romanisation operator, i.e.
source code

Inherited from RomanisationOperator: decompose, getDecompositionTree, getDecompositions, isStrictDecomposition, segment

Inherited from TonalFixedEntityOperator: getPlainReadingEntities, getTonalEntity, getTones, splitEntityTone

Inherited from ReadingOperator: compose, getOption

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

Class Methods [hide private]

Inherited from RomanisationOperator: getDefaultOptions

Static Methods [hide private]

Inherited from RomanisationOperator (private): _crossProduct, _treeToList

Class Variables [hide private]

Inherited from RomanisationOperator: readingEntityRegex

Inherited from ReadingOperator: READING_NAME

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **options)
(Constructor)

source code 

Creates an instance of the TonalRomanisationOperator.

Parameters:
  • options - extra options
  • dbConnectInst - instance of a DatabaseConnector, if none is given, default settings will be assumed.
  • strictSegmentation - if True segmentation (using segment()) and thus decomposition (using decompose()) will raise an exception if an alphabetic string is parsed which can not be segmented into single reading entities. If False the aforesaid string will be returned unsegmented.
Overrides: object.__init__

getReadingEntities(self)

source code 

Gets a set of all entities supported by the reading.

The list is used in the segmentation process to find entity boundaries.

Returns: list of str
list of supported syllables
Overrides: TonalFixedEntityOperator.getReadingEntities

isPlainReadingEntity(self, entity)

source code 

Returns true if the given plain entity (without any tone mark) is recognised by the romanisation operator, i.e. it is a valid entity of the reading returned by the segmentation method.

Reading entities will be handled as being case insensitive.

Parameters:
  • entity (str) - entity to check
Returns: bool
True if string is an entity of the reading, False otherwise.
Overrides: TonalFixedEntityOperator.isPlainReadingEntity

isReadingEntity(self, entity)

source code 

Returns true if the given entity is recognised by the romanisation operator, i.e. it is a valid entity of the reading returned by the segmentation method.

Reading entities will be handled as being case insensitive.

Parameters:
  • entity - entity to check
Returns: bool
True if string is an entity of the reading, False otherwise.
Overrides: ReadingOperator.isReadingEntity
(inherited documentation)