Sha256: 7e9936e1355941a13c0fe2d638233b6758a3ddc32fb1bc5a57e9d1d4e420585b
Contents?: true
Size: 848 Bytes
Versions: 3
Compression:
Stored size: 848 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 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-asr-1.0.1 | lib/adhearsion-asr/result.rb |
adhearsion-asr-1.0.0 | lib/adhearsion-asr/result.rb |
adhearsion-asr-1.0.0.beta1 | lib/adhearsion-asr/result.rb |