spych.data

class spych.data.File(idx, path)
class spych.data.Utterance(idx, file_idx, speaker_idx=None, start=0, end=-1)

An utterance defines an audio sample. Normally an audio file can contain multiple utterances. But every utterance is a part of a file.

class spych.data.Speaker(idx, gender=None)
class spych.data.Segmentation(segments=[], utterance_idx=None, key='text')

Represents a sequence (e.g. Transcription / Alignment).

first_segment

Return the first segment.

classmethod from_audacity(path)

Return the segmentation read from an audacity label file.

classmethod from_ctm(path)

Return a list of segmentations read from a ctm file.

classmethod from_text(text, utterance_idx=None, key='text')

Create a segmentation from a string. It will be space separated into segments.

Parameters:
  • text – The string to be segmented.
  • utterance_idx – Utt id this segmentation belongs to.
  • key – A key which identifies this segmentation.
Returns:

Segmentation object

last_segment

Return the last segment.

to_audacity(path)

Write the segmentation to a audacity label file.

to_ctm(path)

Write the segmentation to a ctm file.

to_text()

Return segments concatenated as space separated string.

class spych.data.FeatureContainer(path)

This class defines a container for storing features (of a given type) of all utterances.

get_statistics()

Return basic stats for the features. Return min,max,mean,meanstdev.