【发布时间】:2014-04-16 01:56:15
【问题描述】:
我正在使用 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);
}
【问题讨论】:
-
需要一个 PTB 格式的数据集来训练系统。我可以看到,从命令行训练可以使用:$ java -cp "*" edu.sta nford.nlp.sentiment.SentimentTraining -numHid 25 -trainPath train.txt devPath dev.txt -train -model model.ser。 gz 但是,如何将其用于其他语言?
-
获得 PTB 文件后,我想知道是否有参数可以指示系统正在使用印地语进行训练,并且作为输入给出的文本是印地语,因此,使用印地语执行情绪分析.
标签: java stanford-nlp sentiment-analysis