Class: PatternRuby::MatchResult
- Inherits:
-
Object
- Object
- PatternRuby::MatchResult
- Defined in:
- lib/pattern_ruby/match_result.rb
Instance Attribute Summary collapse
-
#entities ⇒ Object
readonly
Returns the value of attribute entities.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#intent ⇒ Object
readonly
Returns the value of attribute intent.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Instance Method Summary collapse
- #fallback? ⇒ Boolean
-
#initialize(intent: nil, entities: {}, pattern: nil, score: 0.0, input: nil, metadata: {}, response: nil, fallback: false) ⇒ MatchResult
constructor
A new instance of MatchResult.
- #matched? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(intent: nil, entities: {}, pattern: nil, score: 0.0, input: nil, metadata: {}, response: nil, fallback: false) ⇒ MatchResult
Returns a new instance of MatchResult.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/pattern_ruby/match_result.rb', line 5 def initialize(intent: nil, entities: {}, pattern: nil, score: 0.0, input: nil, metadata: {}, response: nil, fallback: false) @intent = intent @entities = entities @pattern = pattern @score = score @input = input @metadata = @response = response @fallback = fallback end |
Instance Attribute Details
#entities ⇒ Object (readonly)
Returns the value of attribute entities.
3 4 5 |
# File 'lib/pattern_ruby/match_result.rb', line 3 def entities @entities end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
3 4 5 |
# File 'lib/pattern_ruby/match_result.rb', line 3 def input @input end |
#intent ⇒ Object (readonly)
Returns the value of attribute intent.
3 4 5 |
# File 'lib/pattern_ruby/match_result.rb', line 3 def intent @intent end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/pattern_ruby/match_result.rb', line 3 def @metadata end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
3 4 5 |
# File 'lib/pattern_ruby/match_result.rb', line 3 def pattern @pattern end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/pattern_ruby/match_result.rb', line 3 def response @response end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
3 4 5 |
# File 'lib/pattern_ruby/match_result.rb', line 3 def score @score end |
Instance Method Details
#fallback? ⇒ Boolean
21 22 23 |
# File 'lib/pattern_ruby/match_result.rb', line 21 def fallback? @fallback end |
#matched? ⇒ Boolean
17 18 19 |
# File 'lib/pattern_ruby/match_result.rb', line 17 def matched? @intent != nil && !fallback? end |
#to_h ⇒ Object
25 26 27 |
# File 'lib/pattern_ruby/match_result.rb', line 25 def to_h { intent: @intent, entities: @entities, score: @score, pattern: @pattern } end |