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. |
name()
Get the name of the g2p.
Returns: | The g2p name. |
---|---|
Return type: | string |
description()
Get a description of the g2p.
Returns: | The g2p description. |
---|---|
Return type: | string |
language()
Get the g2p language.
Returns: | The g2p language. |
---|---|
Return type: | string |
lang_code()
Get the g2p’s ISO 639-2 language code.
Returns: | The ISO 639-2 language code of the g2p. |
---|---|
Return type: | string |
version()
Get the g2p’s version.
Returns: | The version of the g2p (major, minor). |
---|---|
Return type: | tuple |
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 |
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: |
|
---|---|
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. |
Get the features that are defined for the g2p.
Returns: | A map of the g2p features. |
---|---|
Return type: | SMap |
See also