sentiment analysis - stanford-nlp How to predict document level -


i using stanford-corenlp-3.4.1 version. have question if give sentence has multiple sentence, how calculate prediction.

for eg : string text = "it fantastic experience. pathetice experience";

i getting prediction of

it fantastic experience : positive.

it pathetice experience : negative.

i getting prediction based on each sentence level.how document level.

based on reading total text need either positive or negative.

here sample code:

properties props = new properties();

props.setproperty("annotators","tokenize, ssplit, pos, lemma, parse, sentiment");

    stanfordcorenlp pipeline = new stanfordcorenlp(props);     annotation annotation = new annotation("it fantastic experience. pathetice experience");     pipeline.annotate(annotation);     list<coremap> sentences = annotation.get(coreannotations.sentencesannotation.class);     (coremap sentence : sentences) {       string sentiment = sentence.get(sentimentcoreannotations.classname.class);       system.out.println(sentiment + "\t" + sentence);      } 

results:

very positive: fantastic experience. negative pathetice experience

thanks

to knowledge, stanford nlp not provide sentiment analysis above sentence level. 1 solution compute sort of mean sentiment value across sentences in text, that's going give rough idea of overall sentiment.


Popular posts from this blog