MultispeakerDictionaryMixin#
- class montreal_forced_aligner.dictionary.multispeaker.MultispeakerDictionaryMixin(dictionary_path=None, rules_path=None, phone_groups_path=None, topology_path=None, **kwargs)[source]#
Bases:
TemporaryDictionaryMixin
Mixin class containing information about a pronunciation dictionary with different dictionaries per speaker
- Parameters:
dictionary_path (str) – Dictionary path
kwargs (kwargs) – Extra parameters to passed to parent classes (see below)
See also
DictionaryMixin
For dictionary parsing parameters
TemporaryDirectoryMixin
For temporary directory parameters
- Variables:
dictionary_model (
DictionaryModel
) – Dictionary modeldictionary_lookup (dict[str, int]) – Mapping of dictionary names to ids
- add_words(new_word_data, dictionary_id=None)[source]#
Add word data to a dictionary in the form exported from
words_for_export
- calculate_disambiguation()[source]#
Calculate the number of disambiguation symbols necessary for the dictionary
- calculate_phone_mapping()[source]#
Calculate the necessary phones and add phone objects to the database
- property dictionary_base_names#
Mapping of base file names for pronunciation dictionaries
- export_lexicon(dictionary_id, path, write_disambiguation=False, probability=False)[source]#
Export pronunciation dictionary to a text file
- export_trained_rules(output_directory)[source]#
Export rules with pronunciation and silence probabilities calculated to an output directory
- Parameters:
output_directory (str) – Directory for export
- property grapheme_mapping#
Mapping of phone symbols to integer IDs for Kaldi processing
- property name#
Name of the dictionary
- property num_dictionaries#
Number of pronunciation dictionaries
- property phone_disambig_path#
Path to file containing phone symbols and their integer IDs
- property phone_mapping#
Mapping of phone symbols to integer IDs for Kaldi processing
- property phone_table#
Mapping of phone symbols to integer IDs for Kaldi processing
- property reversed_grapheme_mapping#
A mapping of integer ids to graphemes
- reversed_word_mapping(dictionary_id=1)[source]#
Get the reversed word mapping for a specified dictionary id
- save_oovs_found(directory)[source]#
Save all out of vocabulary items to a file in the specified directory
- Parameters:
directory (str) – Path to directory to save
oovs_found.txt
- property speaker_mapping#
Mapping of speakers to dictionaries
- words_for_export(dictionary_id=None, write_disambiguation=False, probability=False)[source]#
Generate exportable pronunciations
- Parameters:
- Returns:
List of pronunciations as dictionaries
- Return type: