Class: Google::Cloud::Speech::Operation
- Inherits:
-
Object
- Object
- Google::Cloud::Speech::Operation
- Defined in:
- lib/google/cloud/speech/operation.rb
Overview
Operation
A resource represents the long-running, asynchronous processing of a speech-recognition operation. The op can be refreshed to retrieve recognition results once the audio data has been processed.
See Project#process and Audio#process.
Instance Method Summary collapse
-
#done? ⇒ boolean
Checks if the speech-recognition processing of the audio data is complete.
-
#error ⇒ Google::Cloud::Error
The error information if the speech-recognition processing of the audio data has returned an error.
-
#error? ⇒ boolean
Checks if the speech-recognition processing of the audio data has returned an error.
-
#id ⇒ String
The unique identifier for the long running operation.
-
#reload! ⇒ Object
(also: #refresh!)
Reloads the op with current data from the long-running, asynchronous processing of a speech-recognition operation.
-
#results ⇒ Array<Result>
A speech recognition result corresponding to a portion of the audio.
-
#results? ⇒ boolean
Checks if the speech-recognition processing of the audio data is complete.
-
#wait_until_done! ⇒ Object
Reloads the op until the operation is complete.
Instance Method Details
#done? ⇒ boolean
Checks if the speech-recognition processing of the audio data is complete.
101 102 103 |
# File 'lib/google/cloud/speech/operation.rb', line 101 def done? @grpc.done? end |
#error ⇒ Google::Cloud::Error
The error information if the speech-recognition processing of the audio data has returned an error.
176 177 178 179 |
# File 'lib/google/cloud/speech/operation.rb', line 176 def error return nil unless error? Google::Cloud::Error.from_error @grpc.error end |
#error? ⇒ boolean
Checks if the speech-recognition processing of the audio data has returned an error.
201 202 203 |
# File 'lib/google/cloud/speech/operation.rb', line 201 def error? @grpc.error? end |
#id ⇒ String
The unique identifier for the long running operation.
79 80 81 |
# File 'lib/google/cloud/speech/operation.rb', line 79 def id @grpc.name end |
#reload! ⇒ Object Also known as: refresh!
Reloads the op with current data from the long-running, asynchronous processing of a speech-recognition operation.
223 224 225 226 |
# File 'lib/google/cloud/speech/operation.rb', line 223 def reload! @grpc.reload! self end |
#results ⇒ Array<Result>
A speech recognition result corresponding to a portion of the audio.
125 126 127 128 129 130 |
# File 'lib/google/cloud/speech/operation.rb', line 125 def results return nil unless results? @grpc.response.results.map do |result_grpc| Result.from_grpc result_grpc end end |
#results? ⇒ boolean
Checks if the speech-recognition processing of the audio data is complete.
152 153 154 |
# File 'lib/google/cloud/speech/operation.rb', line 152 def results? @grpc.response? end |
#wait_until_done! ⇒ Object
Reloads the op until the operation is complete. The delay between reloads will incrementally increase.
247 248 249 |
# File 'lib/google/cloud/speech/operation.rb', line 247 def wait_until_done! @grpc.wait_until_done! end |