sentiment analysis
**Sentiment analysis** is the NLP task of automatically classifying text as expressing **positive, negative, or neutral** sentiment. It is one of the most widely used NLP applications, enabling organizations to understand opinions, attitudes, and emotions at scale.
**Approaches**
- **Lexicon-Based**: Use predefined dictionaries of positive and negative words (VADER, SentiWordNet) to score text. Simple, interpretable, but misses context.
- **Traditional ML**: Train classifiers (SVM, Naive Bayes, logistic regression) on hand-crafted features (word n-grams, POS tags). Better than lexicons but requires feature engineering.
- **Deep Learning**: Use neural networks (LSTMs, CNNs, transformers) trained on labeled sentiment data. Captures context and nuance.
- **Transformer-Based**: Fine-tuned BERT, RoBERTa, or domain-specific models (FinBERT for finance, BioBERT for biomedical) provide state-of-the-art performance.
- **LLM Zero-Shot**: Use GPT-4, Claude, or similar models with simple prompts — no training data needed. Highly flexible but more expensive per query.
**Granularity Levels**
- **Document-Level**: Overall sentiment of an entire review, article, or post.
- **Sentence-Level**: Sentiment of individual sentences — a document can contain both positive and negative sentences.
- **Aspect-Based**: Sentiment toward specific aspects of an entity (see aspect-based sentiment).
- **Fine-Grained**: Beyond positive/negative — scales like very positive, positive, neutral, negative, very negative (5-class).
**Applications**
- **Brand Monitoring**: Track public sentiment about products, brands, or campaigns across social media.
- **Customer Feedback**: Automatically categorize support tickets, reviews, and survey responses.
- **Financial Markets**: Analyze news, earnings calls, and social media sentiment for trading signals.
- **Political Analysis**: Gauge public opinion on policies, candidates, or issues.
- **Product Development**: Identify customer pain points and feature requests from reviews.
**Challenges**
- **Sarcasm and Irony**: "What a great day to be stuck in traffic" — literal analysis says positive, actual sentiment is negative.
- **Negation**: "Not bad" is positive despite containing a negative word.
- **Domain Specificity**: "Sick beat" is positive in music, negative in healthcare.
- **Subjectivity**: Many statements are mixed or genuinely ambiguous.
Sentiment analysis is a **foundational NLP capability** used across virtually every industry to transform unstructured text into actionable insights.