Class: Google::Cloud::Speech::InterimResult
- Inherits:
-
Object
- Object
- Google::Cloud::Speech::InterimResult
- Defined in:
- lib/google/cloud/speech/result.rb
Overview
# InterimResult
A streaming speech recognition result corresponding to a portion of the audio that is currently being processed.
See Project#stream and Stream#on_interim.
Instance Attribute Summary collapse
-
#alternatives ⇒ Array<Result::Alternative>
readonly
Additional recognition hypotheses (up to the value specified in ‘max_alternatives`).
-
#confidence ⇒ Float
readonly
The confidence estimate between 0.0 and 1.0.
-
#stability ⇒ Float
readonly
An estimate of the probability that the recognizer will not change its guess about this interim result.
-
#transcript ⇒ String
readonly
Transcript text representing the words that the user spoke.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(transcript, confidence, stability, alternatives = []) ⇒ InterimResult
constructor
A new instance of InterimResult.
Constructor Details
#initialize(transcript, confidence, stability, alternatives = []) ⇒ InterimResult
Returns a new instance of InterimResult.
176 177 178 179 180 181 |
# File 'lib/google/cloud/speech/result.rb', line 176 def initialize transcript, confidence, stability, alternatives = [] @transcript = transcript @confidence = confidence @stability = stability @alternatives = alternatives end |
Instance Attribute Details
#alternatives ⇒ Array<Result::Alternative> (readonly)
Additional recognition hypotheses (up to the value specified in ‘max_alternatives`).
171 172 173 |
# File 'lib/google/cloud/speech/result.rb', line 171 def alternatives @alternatives end |
#confidence ⇒ Float (readonly)
The confidence estimate between 0.0 and 1.0. A higher number means the system is more confident that the recognition is correct. This field is typically provided only for the top hypothesis. A value of 0.0 is a sentinel value indicating confidence was not set.
171 172 173 |
# File 'lib/google/cloud/speech/result.rb', line 171 def confidence @confidence end |
#stability ⇒ Float (readonly)
An estimate of the probability that the recognizer will not change its guess about this interim result. Values range from 0.0 (completely unstable) to 1.0 (completely stable). Note that this is not the same as confidence, which estimates the probability that a recognition result is correct.
171 172 173 |
# File 'lib/google/cloud/speech/result.rb', line 171 def stability @stability end |
#transcript ⇒ String (readonly)
Transcript text representing the words that the user spoke.
171 172 173 |
# File 'lib/google/cloud/speech/result.rb', line 171 def transcript @transcript end |
Class Method Details
.from_grpc(grpc) ⇒ Object
185 186 187 188 189 190 191 192 |
# File 'lib/google/cloud/speech/result.rb', line 185 def self.from_grpc grpc head, *tail = *grpc.alternatives return nil if head.nil? alternatives = tail.map do |alt| Result::Alternative.new alt.transcript, alt.confidence end new head.transcript, head.confidence, grpc.stability, alternatives end |