Class: ClassificationResult
- Inherits:
-
Object
- Object
- ClassificationResult
- Defined in:
- lib/engine/classification_result.rb
Instance Attribute Summary collapse
-
#overall_probability ⇒ Object
Returns the value of attribute overall_probability.
-
#sentiment ⇒ Object
Returns the value of attribute sentiment.
-
#text ⇒ Object
Returns the value of attribute text.
-
#token_probabilities ⇒ Object
readonly
Returns the value of attribute token_probabilities.
Instance Method Summary collapse
-
#initialize(text) ⇒ ClassificationResult
constructor
A new instance of ClassificationResult.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(text) ⇒ ClassificationResult
Returns a new instance of ClassificationResult.
5 6 7 8 9 |
# File 'lib/engine/classification_result.rb', line 5 def initialize text @text = text @token_probabilities = [] @sentiment = Sentiment::NEUTRAL end |
Instance Attribute Details
#overall_probability ⇒ Object
Returns the value of attribute overall_probability.
2 3 4 |
# File 'lib/engine/classification_result.rb', line 2 def overall_probability @overall_probability end |
#sentiment ⇒ Object
Returns the value of attribute sentiment.
2 3 4 |
# File 'lib/engine/classification_result.rb', line 2 def sentiment @sentiment end |
#text ⇒ Object
Returns the value of attribute text.
2 3 4 |
# File 'lib/engine/classification_result.rb', line 2 def text @text end |
#token_probabilities ⇒ Object (readonly)
Returns the value of attribute token_probabilities.
3 4 5 |
# File 'lib/engine/classification_result.rb', line 3 def token_probabilities @token_probabilities end |
Instance Method Details
#to_json(*a) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/engine/classification_result.rb', line 11 def to_json(*a) { text: @text, probability: @overall_probability, sentiment: @sentiment }.to_json(*a) end |