简体   繁体   中英

How to train Stanford CoreNLP for other language sentiments?

I am using CoreNLP to calculate sentiment of given text. I have successfully executed it for English. I need to do the same for other languages like Hindi. May I please know how to train the system and use it for other languages? Below is the code for English:

Properties props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, parse, sentiment");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
String text = "I love the display of iPhone but hate its battery life";
Annotation annotation = pipeline.process(text);
for (CoreMap sentence : annotation.get(CoreAnnotations.SentencesAnnotation.class)) {
   Tree tree = sentence.get(SentimentCoreAnnotations.AnnotatedTree.class);
   int sentiment = RNNCoreAnnotations.getPredictedClass(tree);
   System.out.println(sentiment);
}                

Information on training Stanford NLP RNTN is provided by mbatchkarov .

In general, non-English Sentiment Analysis is still a work in progress and many methods - especially those that go beyond bag-of-words - may need to be substantially rethought in order to be applicable to another language. For example, aggulutinative languages like Turkish or German (ie languages that crunch a lot of words into one big word) aren't even going to jive that well on a number of text-mining and sentiment analysis tasks.

Try googling sentiment analysis for Hindi. One interesting paper I found was this one by Mittal, et al .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM