ShanghaineseIPAOperator — IPA for Shanghainese

cjklib.reading.operator.ShanghaineseIPAOperator is an implementation of a transcription of Shanghainese into the International Phonetic Alphabet (IPA).


  • Tones can be given as tone contour numbers (e.g. 55, or superscript ⁵⁵), or IPA tone bar characters,
  • strict tonal rules can be enforced depending the syllable’s initial being voiced or voiceless and the final having a glottal stop,
  • splitting of syllables into onset and rhyme.


class cjklib.reading.operator.ShanghaineseIPAOperator(**options)

Bases: cjklib.reading.operator.TonalIPAOperator

Provides an operator on strings in Shanghainese (Chinese Wu as spoken in Shanghai) written in the International Phonetic Alphabet (IPA).

  • options – extra options
  • dbConnectInst – instance of a DatabaseConnector, if none is given, default settings will be assumed.
  • toneMarkType – type of tone marks, one out of 'numbers', 'chaoDigits', 'ipaToneBar', 'diacritics', 'none'
  • 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. Either behaviour only becomes effective if the chosen 'toneMarkType' makes no use of empty tone marks.
  • constrainEntering – if set to True entering tones will only occur for syllables with glottal stop /ʔ/.
  • constrainToneCategories – if set to True Yin tones will only occur with voiceless and Yang tones only with voiced initials.
classmethod getDefaultOptions()

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

Parameter:plainSyllable (str) – syllable in IPA without tone marks
Return type:tuple of str
Returns:tuple of syllable onset and rhyme
Raises InvalidEntityError:
 if the entity is invalid (e.g. syllable nucleus or tone invalid).
getPlainReadingEntities(*args, **kwargs)

Gets the list of plain entities supported by this reading. These entities will carry no tone mark.

Return type:set of str
Returns:set of supported syllables
getTonalEntity(plainEntity, tone)
isToneValid(plainEntity, tone)

Checks if the given plain entity and tone combination is valid.

This method will always return True by default. If option 'constrainEntering' is set entering tone are only accepted for syllables with glottal stop /ʔ/`. If option ``'constrainToneCategories' is set Yin tones will are only accepted with voiceless and Yang tones only with voiced initials.

  • plainEntity (str) – entity without tonal information
  • tone (str) – tone
Return type:



True if given combination is valid, False otherwise


Table Of Contents

Previous topic

CantoneseIPAOperator — IPA for Cantonese

Next topic

HangulOperator — Hangul

This Page