Previous topic

speect.phoneset – Phoneset Class

Next topic

speect.lexicon – Lexicon Class

speect.addendum – Addendum Class

class speect.addendum.SAddendum

An addendum class, for accessing a defined addendum.

SAddendum.name() Get the name of the addendum.
SAddendum.description() Get a description of the addendum.
SAddendum.language() Get the addendum language.
SAddendum.lang_code() Get the addendum’s ISO 639-2 language code.
SAddendum.version() Get the addendum’s version.
SAddendum.add_word(word, features) Add a word to the addendum.
SAddendum.get_word(word, features) Get a word from the addendum.
SAddendum.features Get the features that are defined for the addendum.
SAddendum.name()

name()

Get the name of the addendum.

Returns:The addendum name.
Return type:string
SAddendum.description()

description()

Get a description of the addendum.

Returns:The addendum description.
Return type:string
SAddendum.language()

language()

Get the addendum language.

Returns:The addendum language.
Return type:string
SAddendum.lang_code()

lang_code()

Get the addendum’s ISO 639-2 language code.

Returns:The ISO 639-2 language code of the addendum.
Return type:string
SAddendum.version()

version()

Get the addendum’s version.

Returns:The version of the addendum (major, minor).
Return type:tuple
SAddendum.add_word()

add_word(word, features)

Add a word to the addendum.

Parameters:
  • word (string) – The word to add.
  • features (dictionary) – Specific features of the word. Features are used to distinguish homographs (i.e. part-of-speech). At least a “phones” or a “syllables” feature must exists in the given features dictionary.
Note :

The addendum takes hold a the features object.

Note :

The added entry is not saved in the addendum file (not persistent).

SAddendum.get_word()

get_word(word, features)

Get a word from the addendum.

Parameters:
  • word (string) – The word to get.
  • features (dict) – Specific features which might distinguish the word if multiple entries of the word exists in the addendum. If None then the first entry of the word is returned.
Returns:

The return value is dependent on the word definition in the addendum, and can be:

  • A list of phones for the given word (no syllables were defined in the addendum).
  • A list of syllables, where the syllables are lists of phones.
  • None if word was not found in the addendum.

As well as a bool value, specifying if the returned list is phones or syllables. If True then syllables were returned, else if False a list of phones were returned.

For example:

list, syllabified = myaddendum.get_word("hello", None)

Return type:

list, bool

SAddendum.features

Get the features that are defined for the addendum.

Returns:A map of the addendum features.
Return type:SMap