class Punchblock::Component::Input::Complete::Match

Public Instance Methods

confidence() click to toggle source
# File lib/punchblock/component/input.rb, line 147
def confidence
  nlsml.best_interpretation[:confidence]
end
inherit(xml_node) click to toggle source
Calls superclass method
# File lib/punchblock/component/input.rb, line 159
def inherit(xml_node)
  self.nlsml = result_node(xml_node)
  super
end
interpretation() click to toggle source
# File lib/punchblock/component/input.rb, line 155
def interpretation
  nlsml.best_interpretation[:instance]
end
mode() click to toggle source
# File lib/punchblock/component/input.rb, line 143
def mode
  nlsml.best_interpretation[:input][:mode]
end
nlsml=(other) click to toggle source
Calls superclass method
# File lib/punchblock/component/input.rb, line 133
def nlsml=(other)
  doc = case other
  when Nokogiri::XML::Element, Nokogiri::XML::Document
    RubySpeech::NLSML::Document.new(other)
  else
    other
  end
  super doc
end
utterance() click to toggle source
# File lib/punchblock/component/input.rb, line 151
def utterance
  nlsml.best_interpretation[:input][:content]
end

Private Instance Methods

result_node(xml) click to toggle source
# File lib/punchblock/component/input.rb, line 166
def result_node(xml)
  directly_nested = xml.at_xpath 'ns:result', ns: NLSML_NAMESPACE
  return directly_nested if directly_nested
  document = Nokogiri::XML.parse xml.text, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS
  document.at_xpath 'ns:result', ns: NLSML_NAMESPACE or raise "Couldn't find the NLSML node"
end