Speech Context

This module contains a context class to manage state between members of the processing pipeline

class spokestack.context.SpeechContext[source]

Class for managing context of the speech pipeline.

add_handler(name, function)[source]

Adds a handler to the context

Parameters
  • name (str) – The name of the event handler

  • function (Callable) – event handler function

Return type

None

property confidence

This property contains the confidence of a classification result.

Returns

model confidence of classification

Return type

float

event(name)[source]

Calls the event handler

Parameters

name (str) – The name of the event handler

Return type

None

property is_active

This property manages activity of the context.

Returns

‘True’ if context is active, ‘False’ otherwise.

Return type

bool

property is_speech

This property is to manage if speech is present in the current state or not.

Returns

‘True’ if is_speech set to ‘True’, ‘False’ otherwise

Return type

bool

reset()[source]

Resets the context state

Return type

None

property transcript

This property is the text representation of the audio buffer

Returns

the value of the transcript property

Return type

str