Reference documentation and code samples for the Cloud Natural Language V2 API class Google::Cloud::Language::V2::Sentiment.
Represents the feeling associated with the entire text or entities in
the text.
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#magnitude
defmagnitude()->::Float
Returns
(::Float) — A non-negative number in the [0, +inf) range, which represents
the absolute magnitude of sentiment regardless of score (positive or
negative).
#magnitude=
defmagnitude=(value)->::Float
Parameter
value (::Float) — A non-negative number in the [0, +inf) range, which represents
the absolute magnitude of sentiment regardless of score (positive or
negative).
Returns
(::Float) — A non-negative number in the [0, +inf) range, which represents
the absolute magnitude of sentiment regardless of score (positive or
negative).
#score
defscore()->::Float
Returns
(::Float) — Sentiment score between -1.0 (negative sentiment) and 1.0
(positive sentiment).
#score=
defscore=(value)->::Float
Parameter
value (::Float) — Sentiment score between -1.0 (negative sentiment) and 1.0
(positive sentiment).
Returns
(::Float) — Sentiment score between -1.0 (negative sentiment) and 1.0
(positive sentiment).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Natural Language V2 API - Class Google::Cloud::Language::V2::Sentiment (v1.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.1.0 (latest)](/ruby/docs/reference/google-cloud-language-v2/latest/Google-Cloud-Language-V2-Sentiment)\n- [1.0.1](/ruby/docs/reference/google-cloud-language-v2/1.0.1/Google-Cloud-Language-V2-Sentiment)\n- [0.7.0](/ruby/docs/reference/google-cloud-language-v2/0.7.0/Google-Cloud-Language-V2-Sentiment)\n- [0.6.0](/ruby/docs/reference/google-cloud-language-v2/0.6.0/Google-Cloud-Language-V2-Sentiment)\n- [0.5.1](/ruby/docs/reference/google-cloud-language-v2/0.5.1/Google-Cloud-Language-V2-Sentiment)\n- [0.4.0](/ruby/docs/reference/google-cloud-language-v2/0.4.0/Google-Cloud-Language-V2-Sentiment)\n- [0.3.2](/ruby/docs/reference/google-cloud-language-v2/0.3.2/Google-Cloud-Language-V2-Sentiment)\n- [0.2.0](/ruby/docs/reference/google-cloud-language-v2/0.2.0/Google-Cloud-Language-V2-Sentiment)\n- [0.1.0](/ruby/docs/reference/google-cloud-language-v2/0.1.0/Google-Cloud-Language-V2-Sentiment) \nReference documentation and code samples for the Cloud Natural Language V2 API class Google::Cloud::Language::V2::Sentiment.\n\nRepresents the feeling associated with the entire text or entities in\nthe text. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #magnitude\n\n def magnitude() -\u003e ::Float\n\n**Returns**\n\n- (::Float) --- A non-negative number in the \\[0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).\n\n### #magnitude=\n\n def magnitude=(value) -\u003e ::Float\n\n**Parameter**\n\n- **value** (::Float) --- A non-negative number in the \\[0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative). \n**Returns**\n\n- (::Float) --- A non-negative number in the \\[0, +inf) range, which represents the absolute magnitude of sentiment regardless of score (positive or negative).\n\n### #score\n\n def score() -\u003e ::Float\n\n**Returns**\n\n- (::Float) --- Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment).\n\n### #score=\n\n def score=(value) -\u003e ::Float\n\n**Parameter**\n\n- **value** (::Float) --- Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment). \n**Returns**\n\n- (::Float) --- Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment)."]]