Class: Google::Cloud::Speech::Job
- Inherits:
-
Object
- Object
- Google::Cloud::Speech::Job
- Defined in:
- lib/google/cloud/speech/job.rb
Overview
Job
A resource represents the long-running, asynchronous processing of a speech-recognition operation. The job can be refreshed to retrieve recognition results once the audio data has been processed.
See Project#recognize_job and Audio#recognize_job.
Instance Method Summary collapse
-
#done? ⇒ boolean
Checks if the speech-recognition processing of the audio data is complete.
-
#reload! ⇒ Object
(also: #refresh!)
Reloads the job 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.
-
#wait_until_done! ⇒ Object
Reloads the job until the operation is complete.
Instance Method Details
#done? ⇒ boolean
Checks if the speech-recognition processing of the audio data is complete.
102 103 104 |
# File 'lib/google/cloud/speech/job.rb', line 102 def done? @grpc.done? end |
#reload! ⇒ Object Also known as: refresh!
Reloads the job with current data from the long-running, asynchronous processing of a speech-recognition operation.
122 123 124 125 |
# File 'lib/google/cloud/speech/job.rb', line 122 def reload! @grpc.reload! self end |
#results ⇒ Array<Result>
A speech recognition result corresponding to a portion of the audio.
76 77 78 79 80 81 82 83 84 |
# File 'lib/google/cloud/speech/job.rb', line 76 def results return nil unless @grpc.response? @grpc.response.results.map do |result_grpc| Result.from_grpc result_grpc end # TODO: Ensure we are raising the proper error # TODO: Ensure GRPC behavior here, is an error already raised? # raise @grpc.error end |
#wait_until_done! ⇒ Object
Reloads the job until the operation is complete. The delay between reloads will incrementally increase.
144 145 146 |
# File 'lib/google/cloud/speech/job.rb', line 144 def wait_until_done! @grpc.wait_until_done! end |