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);
}