【发布时间】:2016-10-16 08:36:43
【问题描述】:
我正在尝试使用 stanford 库设置我的 NLP 解析器。 在我下载的网站上
- stanford-corenlp-full-2015-12-09.zip
- standford-french-corenlp-2016-01-14-models.jar
现在我面临一个问题,如何指示我的应用使用法语模型来分析我的句子。
我实际上有这个代码(适用于英语句子)
String text = "I am very sad";
Properties props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, parse, sentiment");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
Annotation annotation = pipeline.process(text);
List<CoreMap> sentences = annotation.get(CoreAnnotations.SentencesAnnotation.class);
for (CoreMap sentence : sentences) {
String sentiment = sentence.get(SentimentCoreAnnotations.SentimentClass.class);
System.out.println(sentiment + "\t" + sentence);
}
有没有办法在代码中表明我想要法语模型(并尝试解析像“Bonjour, je m'appelle Jean”这样的句子。
谢谢, 亚历克斯
【问题讨论】:
标签: java nlp stanford-nlp