DictionaryModel#

class montreal_forced_aligner.models.DictionaryModel(path, root_directory=None, phone_set_type='UNKNOWN')[source]#

Bases: MfaModel

Class for representing MFA pronunciation dictionaries

Parameters:
  • path (Path) – Path to the dictionary file

  • root_directory (Path, optional) – Path to working directory (currently not needed, but present to maintain consistency with other MFA Models

add_meta_file(trainer)[source]#

Not implemented method

classmethod generate_path(root, name, enforce_existence=True)[source]#

Generate a path for a given model from the root directory and the name of the model

Parameters:
  • root (Path) – Root directory for the full path

  • name (str) – Name of the model

  • enforce_existence (bool) – Flag to return None if the path doesn’t exist, defaults to True

Returns:

Full path in the root directory for the model

Return type:

Path

property is_multiple#

Flag for whether the dictionary contains multiple lexicons

load_dictionary_paths()[source]#

Load the pronunciation dictionaries

Returns:

Mapping of component pronunciation dictionaries

Return type:

dict[str, DictionaryModel]

property meta#

Metadata for the dictionary

property name#

Name of the dictionary

pretty_print()[source]#

Pretty print the dictionary’s metadata

classmethod valid_extension(filename)[source]#

Check whether a file has a valid extension for the given model archive

Parameters:

filename (Path) – File name to check

Returns:

True if the extension matches the models allowed extensions

Return type:

bool