#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){
}
#Create a Keyword Sentiment Analyzer #Tokenize your documents using the Stanford CoreNLP or Apache OpenNLP package (See
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
#Create a Keyword Sentiment Analyzer #Tokenize your documents using the Stanford CoreNLP or Apache OpenNLP package (See
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!