CO - Análise de Sentimento icon

CO - Análise de Sentimento

Analise o sentimento do texto

Overview

This node performs sentiment analysis on a given text input. It sends the text along with its language to an external sentiment analysis service and classifies the sentiment as positive, neutral, or negative based on the polarity score returned by that service.

Common scenarios where this node is useful include:

  • Analyzing customer feedback or reviews to gauge overall sentiment.
  • Monitoring social media posts or comments for brand reputation management.
  • Processing survey responses to understand user satisfaction.

For example, you can input a product review text in Portuguese, specify the language as "pt_br", and the node will return whether the sentiment is positive, neutral, or negative along with a polarity score and descriptive details.

Properties

Name Meaning
Texto Para Analisar The text string to be analyzed for sentiment.
Idioma The language of the input text. Examples: "en" for English, "pt_br" for Brazilian Portuguese.

Output

The node outputs three separate arrays corresponding to the sentiment classification:

  • Positivo: Items where the sentiment is classified as positive (polarity > 0).
  • Neutro: Items where the sentiment is neutral (polarity = 0).
  • Negativo: Items where the sentiment is negative (polarity < 0).

Each output item has the following JSON structure:

{
  "text": "<input text>",
  "sentiment": "positivo" | "neutro" | "negativo",
  "polarity": <numeric polarity score>,
  "describe": <additional descriptive data from the sentiment service>
}

If an error occurs during processing and the node is configured to continue on failure, the error details are included in the neutral output array with the original input data.

Dependencies

  • The node depends on an external HTTP API available at http://192.168.0.210:8544/v1/polarity/unique/ which performs the actual sentiment analysis.
  • No internal credential or authentication mechanism is shown; the API appears to be accessed without authentication or via network configuration.
  • Ensure that the n8n instance has network access to this API endpoint.

Troubleshooting

  • Network errors or timeouts: If the node cannot reach the sentiment analysis API, it will throw an error unless "Continue On Fail" is enabled. Verify network connectivity and that the API server is running.
  • Invalid language codes: Providing unsupported or incorrect language codes may cause unexpected results or errors from the API.
  • Empty or invalid text input: The node requires non-empty text input; empty strings might lead to errors or meaningless results.
  • API response errors: If the API returns malformed data or errors, the node will throw exceptions unless configured to continue on failure.

To resolve these issues:

  • Confirm the API endpoint URL and availability.
  • Validate input parameters before execution.
  • Use the "Continue On Fail" option to handle individual item errors gracefully.

Links and References

Discussion