代码拉取完成,页面将自动刷新
#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);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。