【发布时间】:2018-11-06 17:31:33
【问题描述】:
我想在我的 Unity3D 项目中加入 Stanford CoreNLP。我从Nuget 包含了CoreNLP,并从CoreNLP 下载了NLP 模型。然后我将 NLP 模型文件夹复制到 project -> bin -> Debug 文件夹中。
代码如下:
var jarRoot = @"stanford-corenlp-3.9.1-models\";
const string text = "Kosgi Santosh sent an email to Stanford University. He didn't get a reply.";
var props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
props.setProperty("sutime.binders", "0");
var curDir = Environment.CurrentDirectory;
Directory.SetCurrentDirectory(jarRoot);
var pipeline = new StanfordCoreNLP(props);
Directory.SetCurrentDirectory(curDir);
// Annotation
var annotation = new Annotation(text);
pipeline.annotate(annotation);
var sentences = annotation.get(typeof(CoreAnnotations.SentencesAnnotation));
if (sentences == null)
{
return;
}
foreach (Annotation sentence in sentences as ArrayList)
{
System.Console.WriteLine(sentence);
}
运行后,我只得到了一些错误信息
SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”。
SLF4J:默认为无操作 (NOP) 记录器实现
SLF4J:请参阅http://www.slf4j.org/codes.html#StaticLoggerBinder 更多细节。
我搜索了 SLF4J 站点,但该解决方案仅适用于 Java 项目。我应该如何在我的 C# 项目中解决这个问题?
【问题讨论】:
标签: c# stanford-nlp slf4j