Class: Punchblock::Component::Input

Inherits:
ComponentNode show all
Defined in:
lib/punchblock/component/input.rb

Defined Under Namespace

Classes: Complete, Grammar, Signal

Constant Summary collapse

NLSML_NAMESPACE =
'http://www.ietf.org/xml/ns/mrcpv2'

Instance Attribute Summary

Attributes inherited from RayoNode

#client, #connection, #original_component

Instance Method Summary collapse

Methods inherited from ComponentNode

#add_event, #complete_event, #complete_event=, #initialize, #register_event_handler, #register_internal_handlers, #response=, #stop!, #stop_action, #trigger_event_handler, #write_action

Methods inherited from Punchblock::CommandNode

#initialize, #response, #response=

Methods inherited from RayoNode

#==, class_from_registration, from_xml, #inspect, register, #source, #to_rayo, #to_xml

Constructor Details

This class inherits a constructor from Punchblock::Component::ComponentNode

Instance Method Details

#grammar=(other) ⇒ Object

Parameters:

  • other (Hash)

Options Hash (other):

  • :content_type (String)

    the document content type

  • :value (String)

    the grammar doucment

  • :url (String)

    the url from which to fetch the grammar


48
49
50
# File 'lib/punchblock/component/input.rb', line 48

def grammar=(other)
  self.grammars = [other].compact
end

#grammars=(others) ⇒ Object


38
39
40
# File 'lib/punchblock/component/input.rb', line 38

def grammars=(others)
  super others.map { |other| Grammar.new(other) }
end

#inherit(xml_node) ⇒ Object


52
53
54
55
56
# File 'lib/punchblock/component/input.rb', line 52

def inherit(xml_node)
  grammar_nodes = xml_node.xpath('ns:grammar', ns: self.class.registered_ns)
  self.grammars = grammar_nodes.to_a.map { |grammar_node| Grammar.from_xml(grammar_node)}
  super
end

#initial_timeoutInteger

Returns Indicates the amount of time (in milliseconds) preceding input which may expire before a timeout is triggered.

Returns:

  • (Integer)

    Indicates the amount of time (in milliseconds) preceding input which may expire before a timeout is triggered.


32
# File 'lib/punchblock/component/input.rb', line 32

attribute :initial_timeout, Integer

#inter_digit_timeoutInteger

Returns Indicates (in the case of DTMF input) the amount of time (in milliseconds) between input digits which may expire before a timeout is triggered.

Returns:

  • (Integer)

    Indicates (in the case of DTMF input) the amount of time (in milliseconds) between input digits which may expire before a timeout is triggered.


35
# File 'lib/punchblock/component/input.rb', line 35

attribute :inter_digit_timeout, Integer

#languageString

Returns language to use for speech recognition

Returns:

  • (String)

    language to use for speech recognition


23
# File 'lib/punchblock/component/input.rb', line 23

attribute :language, String

#max_silenceInteger

Returns the amount of time in milliseconds that an input command will wait until considered that a silence becomes a NO-MATCH

Returns:

  • (Integer)

    the amount of time in milliseconds that an input command will wait until considered that a silence becomes a NO-MATCH


11
# File 'lib/punchblock/component/input.rb', line 11

attribute :max_silence, Integer

#min_confidenceFloat

Returns Confidence with which to consider a response acceptable

Returns:

  • (Float)

    Confidence with which to consider a response acceptable


14
# File 'lib/punchblock/component/input.rb', line 14

attribute :min_confidence, Float

#modeSymbol

Returns mode by which to accept input. Can be :voice, :dtmf or :any

Returns:

  • (Symbol)

    mode by which to accept input. Can be :voice, :dtmf or :any


17
# File 'lib/punchblock/component/input.rb', line 17

attribute :mode, Symbol, default: :dtmf

#rayo_attributesObject


58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/punchblock/component/input.rb', line 58

def rayo_attributes
  {
    'max-silence' => max_silence,
    'min-confidence' => min_confidence,
    'mode' => mode,
    'recognizer' => recognizer,
    'language' => language,
    'terminator' => terminator,
    'sensitivity' => sensitivity,
    'initial-timeout' => initial_timeout,
    'inter-digit-timeout' => inter_digit_timeout
  }
end

#rayo_children(root) ⇒ Object


72
73
74
75
76
77
# File 'lib/punchblock/component/input.rb', line 72

def rayo_children(root)
  grammars.each do |grammar|
    grammar.to_rayo(root)
  end
  super
end

#recognizerString

Returns recognizer to use for speech recognition

Returns:

  • (String)

    recognizer to use for speech recognition


20
# File 'lib/punchblock/component/input.rb', line 20

attribute :recognizer, String

#sensitivityFloat

Returns Indicates how sensitive the interpreter should be to loud versus quiet input. Higher values represent greater sensitivity.

Returns:

  • (Float)

    Indicates how sensitive the interpreter should be to loud versus quiet input. Higher values represent greater sensitivity.


29
# File 'lib/punchblock/component/input.rb', line 29

attribute :sensitivity, Float

#terminatorString

Returns terminator by which to signal the end of input

Returns:

  • (String)

    terminator by which to signal the end of input


26
# File 'lib/punchblock/component/input.rb', line 26

attribute :terminator, String