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

Class WadeGilesOperator

source code


Provides an operator for the Mandarin Wade-Giles romanisation.

Features:


To Do (Lang):
Instance Methods [hide private]
 
__init__(self, **options)
Creates an instance of the WadeGilesOperator.
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 by applying a hyphen between syllables.
source code
list of str
removeHyphens(self, readingEntities)
Removes hyphens between two syllables for a given decomposition.
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

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 = 'WadeGiles'
Unique name of reading
  DB_ASPIRATION_APOSTROPHE = u''
Default apostrophe used by Wade-Giles syllable data in database.
  TO_SUPERSCRIPT = {1: u'¹', 2: u'²', 3: u'³', 4: u'', 5: u''}
Mapping of tone numbers to superscript numbers.
  FROM_SUPERSCRIPT = {u'²': 2, u'³': 3, u'¹': 1, u'': 4, u'': 5}
Mapping of superscript numbers to tone numbers.

Inherited from RomanisationOperator: readingEntityRegex

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **options)
(Constructor)

source code 

Creates an instance of the WadeGilesOperator.

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.
  • WadeGilesApostrophe - an alternate apostrophe that is taken instead of the default one.
  • toneMarkType - if set to 'Numbers' appended numbers from 1 to 5 will be used to mark tones, if set to 'SuperscriptNumbers' appended superscript numbers from 1 to 5 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 'fifth' no tone mark is set to indicate the fifth tone (qingsheng, e.g. 'tsan2-men' stands for 'tsan2-men5'), 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 by applying a hyphen between syllables.

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

removeHyphens(self, readingEntities)

source code 

Removes hyphens between two syllables for a given decomposition.

Parameters:
  • readingEntities (list of str) - list of basic syllables or other content
Returns: list of str
the given entity list without separating hyphens

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.

Syllables will use the user specified apostrophe to mark aspiration.

Returns: set of str
set of supported syllables
Overrides: TonalFixedEntityOperator.getPlainReadingEntities