Closed AdamWeishaupt closed 8 years ago
Hi Adam, My "integration" of the Stanford tagger is a pretty ugly hack. The error you are getting makes me suspect you are on a windows machine? If that is the case, then the error makes sense. The "cd" command is the unix cmd for "change directory" . . . on a windows machine this won't work. If I liked my hack a bit better to begin with, I would be to revise the "get_sanford_sentiment" to handle this error better, but I think the better thing to do is rewrite my function to use the new coreNLP library (https://cran.r-project.org/web/packages/coreNLP/coreNLP.pdf). It's going to take me some time to get that done, so you may want to try using the coreNLP directly. Good Luck!
Cheers for the answer, I will have a look at it.
Hi @mjockers, Have you ever been able to find the the solution to this (i.e. running 'get_sanford_sentiment' on windows)?
Sorry, no...and I don't have a windows box to explore the problem.
Hi, I am kind of new to this sentiment and R thing. I am currently still figuring out which code will be best for my purpose. Anyway, I am currently trying syuzhet. But as soon as I reach the point where I like to try the stanford method I get the above error. I have already installed the stanford-corenlp-full-2015-12-09. I have further typed the tagger_path to the location of this package. What else do I need to do???
Code:
https://cran.r-project.org/web/packages/syuzhet/vignettes/syuzhet-vignette.html
library(syuzhet) my_example_text <- "I begin this story with a neutral statement.
Basically this is a very silly test.
You are testing the Syuzhet package using short, inane sentences.
I am actually very happy today. I have finally finished writing this package.
Tomorrow I will be very sad. I won't have anything left to do. I might get angry and decide to do something horrible.
I might destroy the entire package and start from scratch.
Then again, I might find it satisfying to have completed my first R package. Honestly this use of the Fourier transformation is really quite elegant.
You might even say it's beautiful!" s_v <- get_sentences(my_example_text)
class(s_v)
[1] "character"
str(s_v)
chr [1:12] "I begin this story with a neutral statement." ...
head(s_v)
Methods
BING
sentiment_vector <- get_sentiment(s_v, method="bing") sentiment_vector
AFINN
afinn_vector <- get_sentiment(s_v, method="afinn") afinn_vector
NRC
nrc_vector <- get_sentiment(s_v, method="nrc") nrc_vector
Stanford
Stanford Example: Requires installation of coreNLP and path to directory
tagger_path <- "C:/Users/Steffen/Documents/R/win-library/3.2/stanford-corenlp-full-2015-12-09" stanford_vector <- get_sentiment(s_v, method="stanford", tagger_path) stanford_vector
Thanks for a quick answer, Steffen