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

Class JyutpingOperator

source code


Provides an operator for the Cantonese romanisation Jyutping made by the Linguistic Society of Hong Kong (LSHK).


See Also:

Instance Methods [hide private]
 
__init__(self, **options)
Creates an instance of the JyutpingOperator.
source code
list
getTones(self)
Returns a set of tones supported by the reading.
source code
str
compose(self, readingEntities)
Composes the given list of basic entities to a string.
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
set of str
getPlainReadingEntities(self)
Gets the list of plain entities supported by this reading.
source code
tuple of str
getOnsetRhyme(self, plainSyllable)
Splits the given plain syllable into onset (initial) and rhyme (final).
source code

Inherited from TonalRomanisationOperator: getReadingEntities, isPlainReadingEntity, isReadingEntity

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

Inherited from ReadingOperator: getOption

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

Class Methods [hide private]
dict
getDefaultOptions(cls)
Returns the reading operator's default options.
source code
Static Methods [hide private]

Inherited from RomanisationOperator (private): _crossProduct, _treeToList

Class Variables [hide private]
  READING_NAME = 'Jyutping'
Unique name of reading
  readingEntityRegex = re.compile(r'([A-Za-z]+[123456]?)')
Regular Expression for finding romanisation entities in input.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **options)
(Constructor)

source code 

Creates an instance of the JyutpingOperator.

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.
  • toneMarkType - if set to 'Numbers' the default form of appended numbers from 1 to 6 will be used to mark tones, if set to 'None' no tone marks will be used and no tonal information will be supplied at all.
  • missingToneMark - if set to 'noinfo' no tone information will be deduced when no tone mark is found (takes on value None), if set to 'ignore' this entity will not be valid and for segmentation the behaviour defined by 'strictSegmentation' will take affect.
Overrides: object.__init__

getDefaultOptions(cls)
Class Method

source code 

Returns the reading operator's default options.

The default implementation returns an empty dictionary. The keyword 'dbConnectInst' is not regarded a configuration option of the operator and is thus not included in the dict returned.

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

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.
Overrides: TonalFixedEntityOperator.getTones
(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)

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 - entity without tonal information
  • tone - tone
Returns: str
entity with appropriate tone
Raises:
Overrides: TonalFixedEntityOperator.getTonalEntity
(inherited documentation)

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 - entity with tonal information
Returns: tuple
plain entity without tone mark and entity's tone
Raises:
Overrides: TonalFixedEntityOperator.splitEntityTone
(inherited documentation)

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
Overrides: TonalFixedEntityOperator.getPlainReadingEntities
(inherited documentation)

getOnsetRhyme(self, plainSyllable)

source code 

Splits the given plain syllable into onset (initial) and rhyme (final).

The syllabic nasals m, ng will be regarded as being finals.

Parameters:
  • plainSyllable (str) - syllable without tone marks
Returns: tuple of str
tuple of entity onset and rhyme
Raises:

To Do (Impl): Finals ing, ik, ung, uk differ from other finals with same vowels. What semantics/view do we want to provide on the syllable parts?