2 个版本
使用旧 Rust 2015
0.1.1 | 2021年12月1日 |
---|---|
0.1.0 | 2021年2月7日 |
在 文本处理 中排名 #708
每月下载量 799
在 2 个 crate 中使用
125KB
522 行
VADER-Sentiment-Analysis
VADER (Valence Aware Dictionary and sEntiment Reasoner) 是一个词汇和基于规则的 sentiment 分析工具,它 专门针对社交媒体中表达的情感。它完全开源,遵循 MIT 许可协议。 这是一个原始模块的移植,该模块是用 Python 编写的。如果您想做出贡献,请在此查看 原始作者的代码。
用例
* examples of typical use cases for sentiment analysis, including proper handling of sentences with:
- typical negations (e.g., "not good")
- use of contractions as negations (e.g., "wasn't very good")
- conventional use of punctuation to signal increased sentiment intensity (e.g., "Good!!!")
- conventional use of word-shape to signal emphasis (e.g., using ALL CAPS for words/phrases)
- using degree modifiers to alter sentiment intensity (e.g., intensity boosters such as "very" and intensity dampeners such as "kind of")
- understanding many sentiment-laden slang words (e.g., 'sux')
- understanding many sentiment-laden slang words as modifiers such as 'uber' or 'friggin' or 'kinda'
- understanding many sentiment-laden emoticons such as :) and :D
- translating utf-8 encoded emojis such as 💘 and 💋 and 😁
- understanding sentiment-laden initialisms and acronyms (for example: 'lol')
* more examples of tricky sentences that confuse other sentiment analysis tools
* example for how VADER can work in conjunction with NLTK to do sentiment analysis on longer texts...i.e., decomposing paragraphs, articles/reports/publications, or novels into sentence-level analyses
* examples of a concept for assessing the sentiment of images, video, or other tagged multimedia content
* if you have access to the Internet, the demo has an example of how VADER can work with analyzing sentiment of texts in other languages (non-English text sentences).
使用方法
代码
extern crate vader_sentiment;
fn main() {
let analyzer = vader_sentiment::SentimentIntensityAnalyzer::new();
println!("{:#?}", analyzer.polarity_scores("VADER is smart, handsome, and funny."));
println!("{:#?}", analyzer.polarity_scores("VADER is VERY SMART, handsome, and FUNNY."));
}
输出
{
"compound": 0.8316320352807864,
"pos": 0.7457627118644068,
"neg": 0.0,
"neu": 0.2542372881355932
}
{
"compound": 0.9226571915792521,
"pos": 0.7540988645515071,
"neg": 0.0,
"neu": 0.24590113544849293
}
引用信息
如果您在研究中使用了数据集或任何 VADER 情感分析工具(VADER 情感词典或基于规则的 sentiment 分析引擎的 Rust 代码),请引用上述论文。例如
Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.
如有疑问,请联系:C.J. Hutto Georgia Institute of Technology, Atlanta, GA 30032
cjhutto [at] gatech [dot] edu
演示
您可以使用此代码运行一个完整的演示,包括包含讽刺、否定、习语和标点的案例。
extern crate vader_sentiment;
fn main() {
vader_sentiment::demo::run_demo();
}
依赖关系
~2.3–3.5MB
~57K SLoC