Class: Wit::Result
- Inherits:
-
Object
- Object
- Wit::Result
- Defined in:
- lib/wit/wit.rb
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#entities ⇒ Object
readonly
Returns the value of attribute entities.
-
#intent ⇒ Object
readonly
Returns the value of attribute intent.
-
#msg_body ⇒ Object
readonly
Returns the value of attribute msg_body.
-
#msg_id ⇒ Object
readonly
Returns the value of attribute msg_id.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(hash) ⇒ Result
Returns a new instance of Result.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/wit/wit.rb', line 38 def initialize(hash) @raw = hash @msg_id = hash['msg_id'] @msg_body = hash['msg_body'] @intent = hash['outcome']['intent'] @confidence = hash['outcome']['confidence'] @entities = EntityCollection.new hash['outcome']['entities'].each do |name, entity| @entities.send(:"#{name}=", Entity.new(entity)) end end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
36 37 38 |
# File 'lib/wit/wit.rb', line 36 def confidence @confidence end |
#entities ⇒ Object (readonly)
Returns the value of attribute entities.
36 37 38 |
# File 'lib/wit/wit.rb', line 36 def entities @entities end |
#intent ⇒ Object (readonly)
Returns the value of attribute intent.
36 37 38 |
# File 'lib/wit/wit.rb', line 36 def intent @intent end |
#msg_body ⇒ Object (readonly)
Returns the value of attribute msg_body.
36 37 38 |
# File 'lib/wit/wit.rb', line 36 def msg_body @msg_body end |
#msg_id ⇒ Object (readonly)
Returns the value of attribute msg_id.
36 37 38 |
# File 'lib/wit/wit.rb', line 36 def msg_id @msg_id end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
36 37 38 |
# File 'lib/wit/wit.rb', line 36 def raw @raw end |