FileData#

class montreal_forced_aligner.corpus.classes.FileData(name, wav_path, text_path, text_type, relative_path, wav_info=None, speaker_ordering=<factory>, utterances=<factory>)[source]#

Bases: object

Data class for file information

Parameters:
  • name (str) – File name

  • wav_path (str, optional) – Path to sound file

  • text_path (str, optional) – Path to sound file

  • relative_path (str) – Path relative to corpus root directory

  • wav_info (dict[str, Any]) – Information dictionary about the sound file

  • speaker_ordering (list[str]) – List of speakers in the file

  • utterances (list[UtteranceData]) – Utterance data for the file

load_text(root_speaker, ensure_root_speaker=False)[source]#

Load the transcription text from the text_file of the object

Parameters:
  • root_speaker (str) – Speaker derived from the root directory, ignored for TextGrid tiers that have a speaker label

  • ensure_root_speaker (bool, defaults to False) – Flag for ensuring that root_speaker is used as the speaker name

classmethod parse_file(file_name, wav_path, text_path, relative_path, speaker_characters)[source]#

Parse a collection of sound file and transcription file into a File

Parameters:
  • file_name (str) – File identifier

  • wav_path (str) – Full sound file path

  • text_path (str) – Full transcription path

  • relative_path (str) – Relative path from the corpus directory root

  • speaker_characters (int, optional) – Number of characters in the file name to specify the speaker

Returns:

Parsed file

Return type:

FileData