TranscriptionResult - results of an audio transcription

Overview

TranscriptionResult(words, unknownValue, ...)

Descriptor for returned transcription data.

Details

class psychopy.sound.transcribe.TranscriptionResult(words, unknownValue, requestFailed, engine, language)[source]

Descriptor for returned transcription data.

Fields within this class can be used to access transcribed words and other information related to the transcription request.

This is returned by functions and methods which perform speech-to-text transcription from audio data within PsychoPy. The user usually does not create instances of this class themselves.

Parameters:
  • words (list of str) – Words extracted from the audio clip.

  • unknownValue (bool) – True if the transcription API failed make sense of the audio and did not complete the transcription.

  • requestFailed (bool) – True if there was an error with the transcriber itself. For instance, network error or improper formatting of the audio data.

  • engine (str) – Name of engine used to perform this transcription.

  • language (str) – Identifier for the language used to perform the transcription.

property engine

Name of engine used to perform this transcription (str).

property error

True if there was an error during transcription (bool). Value is always the compliment of .success.

getSpeechInterval()[source]

Get the start and stop times for the interval of speech in the audio clip.

This feature is only supported by the Whisper transcriber. The start and end times of the speech interval are returned in seconds.

Returns:

Start and end times of the speech interval in seconds. If the engine does not support this feature, or if the data is missing, (None, None) is returned. In cases where either the start or end time is missing, the value will be None for that field.

Return type:

tuple

property language

Identifier for the language used to perform the transcription (str).

property requestFailed

True if there was an error with the transcriber itself (bool). For instance, network error or improper formatting of the audio data, invalid key, or if there was network connection error.

property response

Raw API response from the transcription engine (str).

property responseData

Values from self.response, parsed into a dict.

property success

True if the transcriber returned a result successfully (bool).

property text

Text transcribed for the audio data (str).

property unknownValue

True if the transcription API failed make sense of the audio and did not complete the transcription (bool).

property wordCount

Number of words found (int).

property wordData

Additional data about each word (list).

Not all engines provide this data in the same format or at all.

property words

Words extracted from the audio clip (list of str).


Back to top