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

Class SimpleEntityOperator

source code


Provides an operator on readings with a single character per entity.

Instance Methods [hide private]
list of str
decompose(self, string)
Decomposes the given string into basic entities that can be mapped to one Chinese character each (exceptions possible).
source code
str
compose(self, readingEntities)
Composes the given list of basic entities to a string.
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: __init__, 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]

decompose(self, string)

source code 

Decomposes the given string into basic entities that can be mapped to one Chinese character each (exceptions possible).

The given input string can contain other non reading characters, e.g. punctuation marks.

The returned list contains a mix of basic reading entities and other characters e.g. spaces and punctuation marks.

The default implementation will raise a NotImplementedError.

Parameters:
  • string - reading string
Returns: list of str
a list of basic entities of the input string
Raises:
Overrides: ReadingOperator.decompose
(inherited documentation)

compose(self, readingEntities)

source code 

Composes the given list of basic entities to a string.

The default implementation will raise a NotImplementedError.

Parameters:
  • readingEntities - list of basic entities or other content
Returns: str
composed entities
Overrides: ReadingOperator.compose
(inherited documentation)

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)