G2PModel#
- class montreal_forced_aligner.models.G2PModel(source, root_directory=None)[source]#
Bases:
ArchiveClass for G2P models
- Parameters:
- 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
- validate_phone_symbols(dictionary)[source]#
Validate this G2P model against a pronunciation dictionary to ensure their phone sets are compatible (i.e., G2P model will not generate phones not in the dictionary)
- Parameters:
dictionary (
DictionaryMixin) – DictionaryMixin to compare phone sets with- Raises:
PronunciationAcousticMismatchError – If there are phones missing from the acoustic model