Sentiment Analyzer Operator
Overview
Section titled “Overview”The Sentiment Analyzer LOP analyzes the sentiment of text input, providing scores and labels to indicate the emotional tone. It supports various analysis backends like Transformers, VADER, TextBlob, and Stanza, allowing you to choose the most suitable method for your needs. This operator can analyze full conversations, specific messages, or custom text, making it versatile for different use cases. The results are displayed in a table or summary format, offering insights into the sentiment trends of the analyzed text.
Requirements
Section titled “Requirements”- Python Packages:
transformers
(if using Transformers backend)vaderSentiment
(if using VADER backend)textblob
(if using TextBlob backend)stanza
(if using Stanza backend) These can be installed via the ChatTD operator’s Python manager.
- ChatTD Operator: Required and must be configured (utilized for
get_sentiment_backend
).
Input/Output
Section titled “Input/Output”Inputs
Section titled “Inputs”- Input Table (DAT): Table containing conversation data. Required columns:
id
,role
,message
.
Outputs
Section titled “Outputs”- Backend-Specific Table (DAT):
vader_table
: VADER scores (compound, pos, neg, neu).transformers_table
: Transformers label and score.textblob_table
: TextBlob polarity and subjectivity.stanza_table
: Stanza sentiment score.
- Summary DAT: Table summarizing analysis results (average scores, etc.).
Parameters
Section titled “Parameters”Sentiment Page
Section titled “Sentiment Page” Message Index (Messageindex)
op('sentiment').par.Messageindex
Integer - Default:
5
Custom Text (Customtext)
op('sentiment').par.Customtext
String - Default:
None
Start Analysis (Analyze)
op('sentiment').par.Analyze
Pulse - Default:
None
Clear Results (Clear)
op('sentiment').par.Clear
Pulse - Default:
None
Status (Status)
op('sentiment').par.Status
String - Default:
Analysis complete
Model Name (Modelname)
op('sentiment').par.Modelname
String - Default:
distilbert-base-uncased-finetuned-sst-2-english
About Page
Section titled “About Page” ChatTD Operator (Chattd)
op('sentiment').par.Chattd
OP - Default:
/dot_lops/ChatTD
Bypass (Bypass)
op('sentiment').par.Bypass
Toggle - Default:
Off
Show Built-in Parameters (Showbuiltin)
op('sentiment').par.Showbuiltin
Toggle - Default:
Off
Version (Version)
op('sentiment').par.Version
String - Default:
1.0.0
Last Updated (Lastupdated)
op('sentiment').par.Lastupdated
String - Default:
2024-11-10
Creator (Creator)
op('sentiment').par.Creator
String - Default:
dotsimulate
Website (Website)
op('sentiment').par.Website
String - Default:
https://dotsimulate.com
Performance Considerations
Section titled “Performance Considerations”- Backend Choice: Transformers models are generally more accurate but slower than VADER or TextBlob.
- Input Size: Analyzing large conversations/texts takes longer. Use
last_message
orspecific_message
modes if performance is critical.
Usage Examples
Section titled “Usage Examples”Analyzing a Full Conversation (VADER)
Section titled “Analyzing a Full Conversation (VADER)”sentiment_op = op('sentiment1')conv_dat = op('conversation_log')
sentiment_op.inputConnectors[0].connect(conv_dat)sentiment_op.par.Analyzemode = 'full_conversation'sentiment_op.par.Backend = 'vader'sentiment_op.par.Analyze.pulse()
# Results in sentiment_op.op('vader_table')
Analyzing Custom Text (Transformers)
Section titled “Analyzing Custom Text (Transformers)”sentiment_op = op('sentiment1')
sentiment_op.par.Analyzemode = 'custom_text'sentiment_op.par.Customtext = "This movie was absolutely fantastic! Highly recommended."sentiment_op.par.Backend = 'transformers'sentiment_op.par.Modelname = 'distilbert-base-uncased-finetuned-sst-2-english' # Default is good for general Englishsentiment_op.par.Analyze.pulse()
# Results in sentiment_op.op('transformers_table')
Displaying Summary
Section titled “Displaying Summary”sentiment_op = op('sentiment1')# ... perform analysis first ...sentiment_op.par.Display = 'summary'
# Summary results in sentiment_op.op('summary_dat')
Common Use Cases
Section titled “Common Use Cases”- Analyzing customer feedback sentiment.
- Monitoring social media for public opinion.
- Tracking emotional trends in chat logs.
- Real-time sentiment display in chatbots.
- Flagging negative messages.