以下是我的代码:
library(sentiment)
library(dplyr)
library(plyr)
library(plotly)
library(ggplot2)
library(readr)
library(tm)
library(Matrix)
library(syuzhet)
moviedata=read.csv('C:/Users/Sudeer/Desktop/movies1.csv',stringsAsFactors = FALSE)
df<-data.frame(moviedata)
View(df)
class_pol = classify_polarity(moviedata, algorithm="bayes")
View(class_pol)
a<-subset(class_pol=)
# get polarity best fit
polarity = class_pol[,4]
# Create data frame with the results and obtain some general statistics
# data frame with results
sent_df = data.frame(text= moviedata,polarity=polarity,stringsAsFactors=FALSE)
View(sent_df)
ggplot(sent_df, aes(x=polarity)) +geom_bar(aes(y=..count.., fill=polarity)) + scale_fill_brewer(palette="RdGy") + labs(x="polarity categories", y="text") + ggtitle("Movie classification")
pos<-subset(sent_df, sent_df$polarity=="positive")
直到现在我从csv文件中获得了积极的意见。在csv文件中,它包含影响印度青年的电影。我把积极的负面意见分开了。从积极的意见来看,我需要R中的文字含义相似。请澄清。