PyniniGenerator#

class montreal_forced_aligner.g2p.generator.PyniniGenerator(word_list=None, g2p_model_path=None, strict_graphemes=False, **kwargs)[source]#

Bases: G2PTopLevelMixin

Class for generating pronunciations from a Pynini G2P model

Parameters:
  • g2p_model_path (str) – Path to G2P model

  • strict_graphemes (bool) – Flag for whether to be strict with missing graphemes and skip words containing new graphemes

See also

G2PTopLevelMixin

For top level G2P generation parameters

Variables:

g2p_model (G2PModel) – G2P model

property data_directory#

Data directory

property data_source_identifier#

Dummy “validation” data source

generate_pronunciations()[source]#

Generate pronunciations

Returns:

Mappings of keys to their generated pronunciations

Return type:

dict[str, list[str]]

property words_to_g2p#

Words to produce pronunciations

property working_directory#

Data directory