Page 1 of 1

#Create a Keyword Sentiment Analyzer #Tokenize your documents using the Stanford CoreNLP or Apache OpenNLP package (See

Posted: Thu Jul 14, 2022 2:13 pm
by answerhappygod
#Create a Keyword Sentiment Analyzer
#Tokenize your documents using the Stanford CoreNLP or ApacheOpenNLP package (See NLP.R on Moodle)
#Create a function called "sentiment(doc)" that takes adocuments as it's input and returns a sentiment score by summingthe number of positive and negative words in a document. The finalscore=number_of_positive_words - number_of_negative_words.
#Useful functions for this lab: #tokenizedwords %in%positivewordlist : This line will check theindividual words membership in the positivewordlist variable. Itreturns a boolean vector. #which(booleanvector) : Thisfunction returns the vector locations with TRUE values in a booleanvector #length(vectorlocations) : This function returns the numberof elements in a vector
#Come up with some documents of your own to test
doc<-"This dinner is WONDERFUL"
sentiment(doc) sentiment<-function(doc){
}