Class: Google::Cloud::Language::Annotation::Sentiment
- Inherits:
-
Object
- Object
- Google::Cloud::Language::Annotation::Sentiment
- Defined in:
- lib/google/cloud/language/annotation.rb
Overview
Represents the result of sentiment analysis.
Instance Attribute Summary collapse
-
#language ⇒ String
readonly
The language of the document (if not specified, the language is automatically detected).
-
#magnitude ⇒ Float
readonly
A non-negative number in the [0, +inf] range, which represents the overall strength of emotion regardless of score (positive or negative).
-
#score ⇒ Float
readonly
The overall emotional leaning of the text in the [-1.0, 1.0] range.
-
#sentences ⇒ Array<Sentence>
readonly
The sentences returned by sentiment analysis.
Instance Attribute Details
#language ⇒ String (readonly)
The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are supported.
1058 1059 1060 |
# File 'lib/google/cloud/language/annotation.rb', line 1058 def language @language end |
#magnitude ⇒ Float (readonly)
A non-negative number in the [0, +inf] range, which represents the overall strength of emotion regardless of score (positive or negative). Unlike score, magnitude is not normalized; each expression of emotion within the text (both positive and negative) contributes to the text's magnitude (so longer text blocks may have greater magnitudes).
1058 1059 1060 |
# File 'lib/google/cloud/language/annotation.rb', line 1058 def magnitude @magnitude end |
#score ⇒ Float (readonly)
The overall emotional leaning of the text in the [-1.0, 1.0] range. Larger numbers represent more positive sentiments.
1058 1059 1060 |
# File 'lib/google/cloud/language/annotation.rb', line 1058 def score @score end |
#sentences ⇒ Array<Sentence> (readonly)
The sentences returned by sentiment analysis.
1058 1059 1060 |
# File 'lib/google/cloud/language/annotation.rb', line 1058 def sentences @sentences end |