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

Class TonalFixedEntityOperator

source code


Provides an abstract ReadingOperator for tonal languages for a reading based on a fixed set of reading entities.

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 TonalFixedEntityOperator.
source code
list
getTones(self)
Returns a set of tones supported by the reading.
source code
str
getTonalEntity(self, plainEntity, tone)
Gets the entity with tone mark for the given plain entity and tone.
source code
tuple
splitEntityTone(self, entity)
Splits the entity into an entity without tone mark (plain entity) and the entity's tone.
source code
list of str
getReadingEntities(self)
Gets a set of all entities supported by the reading.
source code
set of str
getPlainReadingEntities(self)
Gets the list of plain entities supported by this 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 reading operator, i.e.
source code

Inherited from ReadingOperator: compose, decompose, getOption

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

Class Methods [hide private]

Inherited from ReadingOperator: getDefaultOptions

Class Variables [hide private]

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 TonalFixedEntityOperator.

Parameters:
  • options - extra options
Overrides: object.__init__

getTones(self)

source code 

Returns a set of tones supported by the reading. These tones don't necessarily reflect the tones of the underlying language but may defer to reflect notational or other features.

The default implementation will raise a NotImplementedError.

Returns: list
list of supported tone marks.

getTonalEntity(self, plainEntity, tone)

source code 

Gets the entity with tone mark for the given plain entity and tone.

The default implementation will raise a NotImplementedError.

Parameters:
  • plainEntity (str) - entity without tonal information
  • tone - tone
Returns: str
entity with appropriate tone
Raises:

splitEntityTone(self, entity)

source code 

Splits the entity into an entity without tone mark (plain entity) and the entity's tone.

The default implementation will raise a NotImplementedError.

Parameters:
  • entity (str) - entity with tonal information
Returns: tuple
plain entity without tone mark and entity's tone
Raises:

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

getPlainReadingEntities(self)

source code 

Gets the list of plain entities supported by this reading. Different to getReadingEntities() the entities will carry no tone mark.

The default implementation will raise a NotImplementedError.

Returns: set of str
set of supported syllables

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.

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

isReadingEntity(self, entity)

source code 

Returns true if the given entity is recognised by the reading operator, i.e. it is a valid entity of the reading returned by decompose().

The default implementation will raise a NotImplementedError.

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