Sha256: 8ec840cf002524d414798bf8060677c314e7c36ea9613c6f2d8ffbd732b056cd
Contents?: true
Size: 978 Bytes
Versions: 6
Compression:
Stored size: 978 Bytes
Contents
module AdhearsionASR Result = Struct.new(:status, :mode, :confidence, :utterance, :interpretation, :nlsml) do def to_s utterance end def inspect "#<#{self.class} status=#{status.inspect}, confidence=#{confidence.inspect}, utterance=#{utterance.inspect}, interpretation=#{interpretation.inspect}, nlsml=#{nlsml.inspect}>" end def utterance=(other) self[:utterance] = mode == :dtmf ? parse_dtmf(other) : other end def response Adhearsion.deprecated "#utterance" utterance end def match? status == :match end private def parse_dtmf(dtmf) return if dtmf.nil? || dtmf.empty? dtmf.split(' ').inject '' do |final, digit| final << parse_dtmf_digit(digit) end end # @private def parse_dtmf_digit(digit) case tone = digit.split('-').last when 'star' '*' when 'pound' '#' else tone end end end end
Version data entries
6 entries across 6 versions & 1 rubygems