Speech Result#

Speech result representations.

class google.cloud.speech.result.Result(alternatives)[source]#

Bases: object

Speech recognition result representation.

This is the object that comes back on sync or async requests (but not streaming requests).

Parameters:alternatives (list) – List of Alternative.
confidence#

Return the confidence for the most probable alternative.

Return type:float
Returns:Confidence value, between 0 and 1.
classmethod from_api_repr(result)[source]#

Factory: construct instance of Result.

Parameters:result (dict) – Dictionary of a SpeechRecognitionResult
Return type:Result
Returns:Instance of Result.
classmethod from_pb(result)[source]#

Factory: construct instance of Result.

Parameters:result (SpeechRecognitionResult) – Instance of SpeechRecognitionResult protobuf.
Return type:Result
Returns:Instance of Result.
transcript#

Return the transcript for the most probable alternative.

Return type:str
Returns:Speech transcript.
class google.cloud.speech.result.StreamingSpeechResult(alternatives, is_final=False, stability=0.0)[source]#

Bases: object

Streaming speech result representation.

Parameters:
  • alternatives (list) – List of Alternative.
  • is_final (bool) – Boolean indicator of results finality.
  • stability (float) – 0.0-1.0 stability score for the results returned.
confidence#

Return the confidence for the most probable alternative.

Return type:float
Returns:Confidence value, between 0 and 1.
classmethod from_pb(response)[source]#

Factory: construct instance of StreamingSpeechResult.

Parameters:response (StreamingRecognizeResult) – Instance of StreamingRecognizeResult protobuf.
Return type:StreamingSpeechResult
Returns:Instance of StreamingSpeechResult.
transcript#

Return the transcript for the most probable alternative.

Return type:str
Returns:Speech transcript.