Sentiment Analysis
Operating Rule
Use this skill as a fixed command-line workflow. Do not write ad-hoc sentiment analysis code.
- Decide whether the task is covered by dictionary, machine-learning, or LLM sentiment analysis.
- If unsupported, say the skill cannot solve it and name the missing method or input.
- If supported, write a plan before running commands. Include the chosen method, reference file, script, required inputs, required columns, and output path.
- Ask for missing lexicon paths, label columns, model paths, or API key environment details when required.
- Execute the script by command line and report the produced files and key metrics.
Capability Map
- Dictionary method: read
references/dictionary-method.md, then callscripts/dictionary_sentiment.py. - Machine learning method: read
references/machine-learning-method.md, then callscripts/ml_sentiment.py. - LLM method: read
references/llm-method.md, then callscripts/llm_sentiment.py.
Input Expectations
.txt: one text per line..csvor.xlsx: requires--text-column; training also requires--label-column.- Dictionary method requires either positive/negative word lists or a scored lexicon.
- Machine learning training requires labeled examples.
- LLM method requires an OpenAI-compatible API key in an environment variable.
Course Context
This skill follows the current sentiment analysis course notebooks:
- Dictionary method and SnowNLP-style sentiment workflow.
- TF-IDF plus Logistic Regression, SVM, Naive Bayes, and Random Forest.
The scripts are the source of truth for repeatable execution.