nlp - keywords in NEGATIVE Sentiment using sentiment Analysis(stanfordNLP) -


my requirement read input text , undergo sentiment analysis. if sentiment analysis negative should negative keywords used in context.

the following code snippet achieve sentiment analysis:

string tweet="the movie worst";
properties props = new properties(); // props.put("pos.model", "d:\stanford_api's\english-left3words-distsim.tagger"); props.setproperty("annotators", "tokenize, ssplit, pos,lemma,parse, sentiment");

     pipeline = new stanfordcorenlp(props);          int mainsentiment = 0;         if (tweet != null && tweet.length() > 0) {             int longest = 0;              annotation annotation = pipeline.process(tweet);             (coremap sentence : annotation.get(coreannotations.sentencesannotation.class))              {                 tree tree = sentence.get(sentimentcoreannotations.annotatedtree.class);                 int sentiment = rnncoreannotations.getpredictedclass(tree);                 simplematrix sd= rnncoreannotations.getnodevector(tree);                 system.out.println("---sentiment----"+sd.negative().eig());                //system.out.println("---sd.get(0)----"+sd.get(0));                  string parttext = sentence.tostring();                 if (parttext.length() > longest)                  {                     mainsentiment = sentiment;                     longest = parttext.length();                 }             }         } 

pls suggest how can keywords sentence if sentiment analysis negative ?


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -