2 Star 1 Fork 0

shinevien/textanalysis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
emotionAnalysis.r 992 Bytes
一键复制 编辑 原始数据 按行查看 历史
shinevien 提交于 2016-01-28 11:02 . text mining
#emotionAnalysis.r create by zhenghaimin
#
kind_num <- 7;
happy <- c("PA", "PE");
good <- c("PD", "PH", "PG", "PB", "PK");
angry <- c("NA");
sad <- c("NB", "NJ", "NH", "PF");
fear <- c("NI", "NC", "NG");
boring <- c("NE", "ND", "NN", "NK", "NL");
suprise <- c("PC");
kind_list <- list(happy, good, angry, sad, fear, boring, suprise);
print(happy)
happy_counter <- 0;
good_counter <- 0;
angry_counter <- 0;
sad_counter <- 0;
fear_counter <- 0;
boring_counter <- 0;
suprise_counter <- 0;
counter_list <- c(happy_counter, good_counter, angry_counter, sad_counter, fear_counter,
boring_counter, suprise_counter);
print(counter_list)
for (i in 1: length(mergeframe$kind)) {
kind <- mergeframe$kind[i];
for (j in 1: kind_num) {
result <- match(kind, unlist(kind_list[j]), nomatch = -1);
if (result != -1) {
counter_list[j] = counter_list[j] + 1;
print(kind_list[j]);
}
}
}
print(counter_list);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
R
1
https://gitee.com/shinevien/textanalysis.git
git@gitee.com:shinevien/textanalysis.git
shinevien
textanalysis
textanalysis
master

搜索帮助