G2PModel#

class montreal_forced_aligner.models.G2PModel(source, root_directory=None)[source]#

Bases: Archive

Class for G2P models

Parameters:
  • source (str) – Path to source archive

  • root_directory (str) – Path to save exported model

add_fst_model(source_directory)[source]#

Add FST file into archive

Parameters:

source_directory (str) – Source directory path

add_meta_file(g2p_trainer)[source]#

Construct metadata information for the G2P model from the dictionary it was trained from

Parameters:

g2p_trainer (G2PTrainer) – Trainer for the G2P model

add_sym_path(source_directory)[source]#

Add symbols file into archive

Parameters:

source_directory (str) – Source directory path

export_fst_model(destination)[source]#

Extract FST model path to destination

Parameters:

destination (str) – Destination directory

property fst_path#

G2P model’s FST path

property grapheme_sym_path#

G2P model’s grapheme symbols path

property meta#

Metadata for the G2P model

property sym_path#

G2P model’s symbols path

validate(word_list)[source]#

Validate the G2P model against a word list to ensure that all graphemes are known

Parameters:

word_list (Collection[str]) – Word list to validate against

Returns:

False if missing graphemes were found

Return type:

bool