Method: WitBot::Outcome#initialize

Defined in:
lib/wit_bot/models/outcome.rb

#initialize(message, raw, i = 0) ⇒ Outcome

Returns a new instance of Outcome.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/wit_bot/models/outcome.rb', line 5

def initialize(message, raw, i=0)
  @message = message
  @raw = raw.with_indifferent_access

  @confidence = @raw[:confidence]
  @_text = @raw[:_text]

  @intent = WitModel::Intent.find raw[:intent]
  @entities = EntityModelProxy.new raw[:entities]

  raise LowConfidenceError self if i == 0 && low_confidence?
end