Previous topic

speect.pyobject_ebml – Python Objects EBML Serialization Support

Next topic

speect.phoneset – Phoneset Class

speect.g2p – G2P Class

class speect.g2p.SG2P

An g2p (grapheme-to-phoneme) class.

SG2P.name() Get the name of the g2p.
SG2P.description() Get a description of the g2p.
SG2P.language() Get the g2p language.
SG2P.lang_code() Get the g2p’s ISO 639-2 language code.
SG2P.version() Get the g2p’s version.
SG2P.apply(word) Apply the g2p to the given word to get a phone list.
SG2P.apply_at(word, index) Apply the g2p to the grapheme at given index in the given word to get a phone.
SG2P.features Get the features that are defined for the g2p.
SG2P.name()

name()

Get the name of the g2p.

Returns:The g2p name.
Return type:string
SG2P.description()

description()

Get a description of the g2p.

Returns:The g2p description.
Return type:string
SG2P.language()

language()

Get the g2p language.

Returns:The g2p language.
Return type:string
SG2P.lang_code()

lang_code()

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

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

version()

Get the g2p’s version.

Returns:The version of the g2p (major, minor).
Return type:tuple
SG2P.apply()

apply(word)

Apply the g2p to the given word to get a phone list.

Parameters:word (string) – The word to convert to a phone list.
Returns:A list of phones for the given word or None if the g2p failed. If the g2p failed a warning will be set in the error log.
Return type:list
SG2P.apply_at()

apply_at(word, index)

Apply the g2p to the grapheme at given index in the given word to get a phone. This method can be seen as a single step of the SG2P::apply method. It returns the phone of the grapheme at the index.

Parameters:
  • word (string) – The word to get a phone from at the given grapheme index.
  • index – The index of the grapheme, in the word, for which the phone is requested.
Returns:

The phone of the grapheme at the index in the word.

Return type:

string

Note :

Indexing starts at 0.

Note :

The returned phone can be None, this is not necessarily an error.

SG2P.features

Get the features that are defined for the g2p.

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

See also

speect.SMap