Cloud NiFi Processors
  • Calculated Systems NiFi Processors
  • Amazon Web Services
    • Comprehend API
      • DetectDominantLanguage Processor
      • DetectKeyPhrases Processor
      • DetectEntities Processor
        • Entity Types
      • DetectSentiment Processor
      • DetectSyntax Processor
    • Textract API
      • DetectDocumentText Processor
      • AnalyzeDocument Processor
      • Block Types
  • Google Cloud Platform
    • Natural Language API
      • AnalyzeSyntax Processor
      • AnalyzeEntities Processor
      • AnalyzeSentiment Processor
      • AnalyzeEntitiesWithSentiment Processor
      • ClassifyText Processor
      • AnnotateText Processor
      • Entity Types
      • The Metadata Field
Powered by GitBook
On this page
  • Properties
  • Data Output

Was this helpful?

  1. Google Cloud Platform
  2. Natural Language API

AnalyzeSentiment Processor

Part of the GCP Natural Language processor family

PreviousAnalyzeEntities ProcessorNextAnalyzeEntitiesWithSentiment Processor

Last updated 5 years ago

Was this helpful?

This processor takes in an input string and returns information about the sentiment of the text. Sentiment can be thought of as the connotation of the message. This processor will analyze the sentiment of individual sentences as well as the text overall.

The resulting Sentiments are reported with two values: score and magnitude. Per the :

score ranges from -1.0 (negative sentiment) to 1.0 (positive sentiment) magnitude indicates the overall strength of the emotion (both positive and negative)

This means that, for example, a sentence with a sentiment that has a score of 0.8 and a magnitude of 1.7 means it's a very strongly positive message. Similarly, a sentiment with a score of -0.2 with a magnitude of 0.2 is likely a "lightly" negative message.

The example output is a great example of the strength / sentiment. The message is overall a very positive message, and the output reflects as such.

Properties

All of our Natural Language processors also include these .

This processor does not have any unique properties outside of the common ones.

Data Output

Field Name

Data Type

Description

sentences

array of Sentence

The list of all sentences in the message

language

string

The language code of the language the message is in.

overallSentiment

Sentiment

The sentiment of the message as a whole

Sentence

Field Name

Data Type

Description

text

string

The raw string of the sentence

sentiment

Sentiment

The sentiment of this sentence

beginOffset

int

The number of characters from the beginning of the input string to the start of this sentence

Sentiment

Field Name

Data Type

Description

score

float

A number ranging from -1.0 (negative sentiment) to 1.0 (positive sentiment)

magnitude

float

A number ranging from 0 to +inf representing the absolute magnitude of the sentiment (regardless of score). This number can be thought of as the strength of the emotion (e.g., something being very positive, or slightly negative)

{
   "output":{
      "overallSentiment":{
         "score":0.5,
         "magnitude":1.7
      },
      "sentences":[
         {
            "sentiment":{
               "score":0.6,
               "magnitude":0.6
            },
            "text":"James Adams is a fantastic developer who has been on the scene for over ten years."
         },
         {
            "sentiment":{
               "score":0.9,
               "magnitude":0.9
            },
            "text":"His excellent attitude and steady work ethic contribute to his character."
         },
         {
            "sentiment":{
               "score":0.2,
               "magnitude":0.2
            },
            "text":"May he stay with our company for many years to come."
         }
      ],
      "language":"en"
   },
   "raw-input":"James Adams is a fantastic developer who has been on the scene for over ten years. His excellent attitude and steady work ethic contribute to his character. May he stay with our company for many years to come."
}

official documentation
common properties