How modarwish1/sentimentr works
sentimentr is a Python sentiment-analysis library for formal and informal text. Its principal workflow accepts a document through Sentiment.get_polarity_score, evaluates clauses and matched lexical items using contextual rules, then combines and normalizes polarity into a document score. The README also documents idioms, emojis, emoticons, and subjectivity alongside the core formal and informal rules. The runtime is concentrated in one source file; the graph separates its documented stages while pointing to that implementation. Some internal calls are not visible in the excerpts, so documented relationships use README evidence.
Main entry points: sentimentr.py Lexical matching · lexica Lexica and modifiers
Components 11
Public API
- Sentiment API
sentimentr/sentimentr.py - Document score
sentimentr/sentimentr.py
Sentiment analysis
- Clause analysis
sentimentr/sentimentr.py - Lexical matching
sentimentr/sentimentr.py - Formal context rules
sentimentr/sentimentr.py - Informal context rules
sentimentr/sentimentr.py - Polarity aggregation
sentimentr/sentimentr.py
Lexical resources
- Lexica and modifiers
sentimentr/lexica
Other components
- Library caller
- NLTK tokenizer
- WordNet
Connections 12
- Library caller → Sentiment API: calls
README.md - Sentiment API → Clause analysis: analyzes clauses
README.md - Clause analysis → Lexical matching: matches terms
README.md - Lexical matching → Lexica and modifiers: loads resources
sentimentr/sentimentr.py - Clause analysis → NLTK tokenizer: tokenizes text
sentimentr/sentimentr.py - Lexical matching → Formal context rules: refines polarity
README.md - Lexical matching → Informal context rules: refines polarity
README.md - Formal context rules → WordNet: checks word forms
README.md - Informal context rules → Polarity aggregation: contributes clause scores
README.md - Formal context rules → Polarity aggregation: contributes clause scores
README.md - Polarity aggregation → Document score: normalizes score
README.md - Sentiment API → Document score: returns score
README.md