找回密码
 注册
查看: 914|回复: 0

R语言 sentiment包 classify_polarity()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 01:09:13 | 显示全部楼层 |阅读模式
classify_polarity(sentiment)
classify_polarity()所属R语言包:sentiment

                                         classifies the polarity (e.g. positive or negative) of a set of texts.
                                         文本的一组分类的极性(例如,正或负)。

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Classifies the polarity (e.g. positive or negative) of a set of texts using a naive Bayes classifier trained on Janyce Wiebe's subjectivity lexicon.
分类极性(例如:正面或负面的),一组使用朴素贝叶斯分类器的训练Janyce韦博subjectivity词汇的文本。


用法----------Usage----------


classify_polarity(textColumns,algorithm="bayes",pstrong=0.5,pweak=1.0,
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算法。


参数:pstrong
A numeric specifying the probability that a strongly subjective term appears in the given text.  
Anumeric指定一个强烈的主观的词出现的概率在给定的文本。


参数:pweak
A numeric specifying the probability that a weakly subjective term appears in the given text.  
Anumeric指定给定文本中出现的概率是一个弱主观的术语。


参数: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 four columns and one row for each document.
返回类的一个对象data.frame四列一列的每个文档。


参数:pos
The absolute log likelihood of the document expressing a positive sentiment.
绝对的对数似然的文档表达的乐观情绪。


参数:neg
The absolute log likelihood of the document expressing a negative sentiment.
绝对的对数似然表达负面情绪的文件。


参数:pos/neg
The ratio of absolute log likelihoods between positive and negative sentiment scores. A score of 1 indicates a neutral sentiment, less than 1 indicates a negative sentiment, and greater than 1 indicates a positive sentiment.
之比的绝对值的log的似然性之间的积极和消极情绪分数。 1分表示情绪中性,小于1表示一个负面情绪,大于1表示一个积极的情绪。


参数:best_fit
The most likely sentiment category (e.g. positive, negative, neutral) 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.",
                                "With nightfall approaching, Los Angeles authorities are urging residents to keep their
                                outdoor lights on as police and fire officials try to catch the person or people responsible
                                for nearly 40 arson fires in the last three days.")
                               
# CLASSIFY POLARITY[类别POLARITY]
classify_polarity(documents,algorithm="bayes",verbose=TRUE)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-19 23:52 , Processed in 0.022554 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表