classify_emotion(sentiment)
classify_emotion()所属R语言包:sentiment
classifies the emotion (e.g. anger, disgust, fear, joy, sadness, surprise) of a set of texts.
分类的情绪(如愤怒,厌恶,恐惧,快乐,悲伤,惊奇地)的一组文本。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Classifies the emotion (e.g. anger, disgust, fear, joy, sadness, surprise) of a set of texts using a naive Bayes classifier trained on Carlo Strapparava and Alessandro Valitutti's emotions lexicon.
分类的情绪(如愤怒,厌恶,恐惧,快乐,悲伤,惊奇地)的一组文本,使用朴素贝叶斯分类器的训练,卡罗Strapparava和亚历山德罗Valitutti的emotions词汇。
用法----------Usage----------
classify_emotion(textColumns,algorithm="bayes",prior=1.0,verbose=FALSE,...)
参数----------Arguments----------
参数:textColumns
A data.frame of text documents listed one per row.
Adata.frame上市每行的文本文件。
参数:algorithm
A string indicating whether to use the naive bayes algorithm or a simple voter algorithm.
Astring表明是否使用天真的bayes算法或简单的voter算法。
参数:prior
a numeric specifying the prior probability to use for the naive Bayes classifier.
numeric指定使用的朴素贝叶斯分类器的先验概率。
参数:verbose
A logical specifying whether to print detailed output regarding the classification process.
Alogical指定是否打印在分类过程中的详细输出。
参数:...
Additional parameters to be passed into the create_matrix function.
额外的参数传递到create_matrix的函数。
值----------Value----------
Returns an object of class data.frame with seven columns and one row for each document.
返回类的一个对象data.frame 7列和行的每个文件。
参数:anger
The absolute log likelihood of the document expressing an angry sentiment.
绝对的对数似然的文件表达愤怒的情绪。
参数:disgust
The absolute log likelihood of the document expressing a disgusted sentiment.
绝对的对数似然的文件表示厌恶的情绪。
参数:fear
The absolute log likelihood of the document expressing a fearful sentiment.
绝对的对数似然的文件表达了一个可怕的情绪。
参数:joy
The absolute log likelihood of the document expressing a joyous sentiment.
绝对的对数似然的文件表达欢乐的情绪。
参数:sadness
The absolute log likelihood of the document expressing a sad sentiment.
绝对的对数似然的文件表达了悲伤的情绪。
参数:surprise
The absolute log likelihood of the document expressing a surprised sentiment.
绝对的对数似然的文件表达惊讶的情绪。
参数:best_fit
The most likely sentiment category (e.g. anger, disgust, fear, joy, sadness, surprise) for the given text.
最有可能的情绪类别(如愤怒,厌恶,恐惧,快乐,悲伤,惊奇地)给定的文本。
(作者)----------Author(s)----------
Timothy P. Jurka <tpjurka@ucdavis.edu>
实例----------Examples----------
# LOAD LIBRARY[加载库]
library(sentiment)
# DEFINE DOCUMENTS[定义文档]
documents <- c("I am very happy, excited, and optimistic.",
"I am very scared, annoyed, and irritated.",
"Iraq's political crisis entered its second week one step closer to the potential
dissolution of the government, with a call for elections by a vital coalition partner
and a suicide attack that extended the spate of violence that has followed the withdrawal
of U.S. troops.")
# CLASSIFY EMOTIONS[类别EMOTIONS]
classify_emotion(documents,algorithm="bayes",verbose=TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|