FileData#

class montreal_forced_aligner.corpus.classes.FileData(name, wav_path, text_path, text_type, relative_path, wav_info=None, speaker_ordering=[], utterances=[])[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=None)[source]#

Load the transcription text from the text_file of the object

Parameters:

root_speaker (str, optional) – Speaker derived from the root directory, ignored for TextGrids

classmethod parse_file(file_name, wav_path, text_path, relative_path, speaker_characters, enforce_sample_rate=None)[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

  • sanitize_function (Callable, optional) – Function to sanitize words and strip punctuation

Returns:

Parsed file

Return type:

FileData