class AzureSTT::Parsers::RecognizedPhrase
Parse a recognized phrase from a result file to Models::RecognizedPhrase
Protected Instance Methods
build_attributes()
click to toggle source
Build a hash to instantiate a Models::RecognizedPhrase
@return [Hash]
# File lib/azure_stt/parsers/recognized_phrase.rb, line 16 def build_attributes { recognition_status: hash['recognitionStatus'], channel: hash['channel'], speaker: hash['speaker'], offset: hash['offset'], duration: hash['duration'], offset_in_ticks: hash['offsetInTicks'], duration_in_ticks: hash['durationInTicks'], n_best: build_n_best }.compact end
Private Instance Methods
build_n_best()
click to toggle source
Build the n_best fiels if the RecognizedPhrase
.
@return [Array]
# File lib/azure_stt/parsers/recognized_phrase.rb, line 36 def build_n_best hash['nBest'].map do |sentence_hash| Models::Sentence.new( Sentence.new(sentence_hash).attributes ) end end