我正在使用CoreNLP来计算给定文本的情感分析。我已经成功地对英语执行了它。我需要为其他语言(如印地语)执行相同的操作。请问如何训练系统并将其用于其他语言?下面是英语代码:
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);
}