speechtotext.datasets.SampleDataset
- class SampleDataset(df, path_to_dir, name, file_ext='.wav')[source]
Bases:
DatasetBareSample of dataset.
Creates dataset object. There needs to be an transcripts.txt directly in the dir. :type path_to_dir:
str:param path_to_dir: Path to dir ending with “/”. :type path_to_dir: str :type name:str:param name: Name of dataset. :type name: str :type file_ext:str:param file_ext: Extention of files. :type file_ext: strMethods
Gets path of fragment.
Get text of fragment id.
Get number of samples in dataset.
Validate if samples have a corresponding file.
- get_path_of_fragment(audio_id)
Gets path of fragment.
- Parameters:
id (str) – Id of file.
- Raises:
FileNotFoundError – If id doesn’t exist.
- Returns:
Path to fragment.
- Return type:
- get_text_of_id(audio_id)
Get text of fragment id.
- number_of_samples()
Get number of samples in dataset.
- Returns:
Number of samples in dataset.
- Return type: