class AzureSTT::Parsers::Sentence
Parse the “nBest” field from the result file to a Models::Sentence
Protected Instance Methods
build_attributes()
click to toggle source
Build the attributes needed to instantiate a Models::Sentence
@return [Hash]
# File lib/azure_stt/parsers/sentence.rb, line 18 def build_attributes { confidence: hash['confidence'], lexical: hash['lexical'], itn: hash['itn'], masked_itn: hash['maskedITN'], transcript: hash['display'], words: build_words }.compact end
Private Instance Methods
build_words()
click to toggle source
Build the words. Returns nil if they are not defined
@return [Array]
# File lib/azure_stt/parsers/sentence.rb, line 36 def build_words hash['words']&.map do |word_hash| Models::Word.new( Word.new(word_hash).attributes ) end end