R 情感分析
Ted Kwartler
Data Dude
library(qdap)
library(magrittr)
text_df %$% polarity(text)
回傳一個「polarity」物件,含正負分數。
主觀性詞彙表是預先定義的詞清單,標註情緒語境,如正向/負向,或特定情緒如「frustration」或「joy」。
qdap 的 polarity() 使用 hash_sentiment_huliu 詞彙表
tidytext 提供 sentiments tibble,內含
| Name | Description |
|---|---|
dodds_sentiment |
Mechanical Turk 情感詞彙 |
hash_emoticons |
基本文字符號表情的對應 :) |
hash_sentiment_huliu |
U of IL @CHI 的極性(+/-)詞彙研究 |
hash_sentiment_jockers |
承襲自 library(syuzhet) 的詞彙表 |
hash_sentiment_nrc |
群眾外包的 5,468 個詞,分數介於 -1 與 1 之間 |

| Rank | City | 2010 Census Population | Actual % | Zipf's Expected % |
|---|---|---|---|---|
| 1 | New York | 8,175,133 | 100% | ... |
| 2 | LA | 3,792,621 | 46% | 50% |
| 3 | Chicago | 2,695,598 | 33% | 33% |
| 4 | Houston | 2,100,263 | 26% | 25% |
| 5 | Philadelphia | 1,526,006 | 19% | 20% |
如果達成同一目標有多種方法,人們會選擇最省力的做法。



R 情感分析