Skip to content

情感分析节点(Sentiment Analysis node)#

使用“情感分析”节点分析传入文本数据的情感。

🌐 Use the Sentiment Analysis node to analyze the sentiment of incoming text data.

语言模型使用节点选项中的情感类别来确定每个项目的情感倾向。

🌐 The language model uses the Sentiment Categories in the node options to determine each item's sentiment.

节点参数(Node parameters)#

  • 要分析的文本 定义了用于情感分析的输入文本。这是一个引用输入项字段的表达式。例如,如果输入来自聊天或消息来源,这可以是 {{ $json.chatInput }}。默认情况下,它期望一个 text 字段。

节点选项(Node options)#

  • 情感类别:定义你希望将输入分类的类别。
    • 默认情况下,这些是 Positive, Neutral, Negative。你可以自定义这些类别以适应你的特定用例,例如使用 Very Positive, Positive, Neutral, Negative, Very Negative 进行更细化的分析。
  • 包含详细结果:启用此选项时,输出中将包含情感强度和置信度评分。请注意,这些评分是由语言模型生成的估算值,仅为参考指标,而非精确的测量结果。
  • 系统提示模板:使用此选项来更改用于情感分析的系统提示。它使用 {categories} 占位符来表示类别。
  • 启用自动修复:启用后,该节点会自动修复模型输出,以确保其符合预期格式。操作方法是将模式解析错误发送给大语言模型(LLM),并让其进行修复。

使用说明(Usage Notes)#

模型温度设置(Model Temperature Setting)#

强烈建议将连接的语言模型的温度设置为0或接近0的值。这有助于确保结果尽可能确定,从而在多次运行中提供更一致、更可靠的情感分析。

🌐 It's strongly advised to set the temperature of the connected language model to 0 or a value close to 0. This helps ensure that the results are as deterministic as possible, providing more consistent and reliable sentiment analysis across multiple runs.

语言注意事项(Language Considerations)#

节点的性能可能因输入文本的语言而异。

🌐 The node's performance may vary depending on the language of the input text.

为了获得最佳结果,请确保你选择的语言模型支持输入语言。

🌐 For best results, ensure your chosen language model supports the input language.

处理大量数据(Processing Large Volumes)#

分析大量文本时,请考虑将输入拆分为更小的块,以优化处理时间和资源使用。

🌐 When analyzing large amounts of text, consider splitting the input into smaller chunks to optimize processing time and resource usage.

迭代细化(Iterative Refinement)#

对于复杂的情感分析任务,你可能需要反复调整系统提示和类别,才能达到预期结果。

🌐 For complex sentiment analysis tasks, you may need to iteratively refine the system prompt and categories to achieve the desired results.

示例用法(Example Usage)#

基本情感分析(Basic Sentiment Analysis)#

  1. 将数据源(例如,RSS 源、HTTP 请求)连接到情感分析节点。
  2. 将“要分析的文本”字段设置为相关的项目属性(例如,博客文章内容可以使用 {{ $json.content }})。
  3. 保留默认情感类别。
  4. 将节点的输出连接到不同的路径,以便分别处理正面、中性和负面情绪。

自定义类别分析(Custom Category Analysis)#

  1. 情感类别更改为Excited, Happy, Neutral, Disappointed, Angry
  2. 调整你的工作流程以处理这五种输出类别。
  3. 使用此设置以更细致的情感类别分析客户反馈。

View n8n's Advanced AI documentation.