Expand description
§sentiment-basic
Simple, deterministic positive/negative word-count sentiment scoring with built-in word lists. Pure Rust, zero dependencies, no network, no model downloads — the same lightweight signal the BeLikeNative AI writing assistant uses for a fast first-pass tone read.
This is a lexicon scorer, not a machine-learning model. It is fast, fully deterministic, auditable, and works offline. The trade-off is that it does not understand negation, sarcasm, or context — pair it with a real model for nuanced analysis.
§Quick example
use sentiment_basic::score;
let r = score("I love this bright, happy day. It is awful and terrible though.");
assert!(r.positive_hits >= 3); // love, bright, happy
assert!(r.negative_hits >= 2); // awful, terrible
assert!(r.comparison() > 0.0); // 3 positive vs 2 negative -> leans positiveStructs§
- Sentiment
- The polarity result of scoring a piece of text.
Constants§
- NEGATIVE_
WORDS - The built-in negative-polarity lexicon.
- POSITIVE_
WORDS - The built-in positive-polarity lexicon.
Functions§
- score
- Score
textagainst the built-in lexicons.