【发布时间】:2019-06-26 21:11:31
【问题描述】:
我通过 IKVM Java 接口在 C# 中使用斯坦福 NLP 工具。也从https://sergey-tihon.github.io/Stanford.NLP.NET/StanfordCoreNLP.html得到想法
String text = "This is a test sentence.";
var props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, parse");
var curDir = Environment.CurrentDirectory;
Directory.SetCurrentDirectory(modelsDirectory);
var pipeline = new StanfordCoreNLP(props);
Directory.SetCurrentDirectory(curDir);
var annotation = new Annotation(text);
pipeline.annotate(annotation);
此代码可以很好地获取我的Annotation。但是,当我尝试访问注释以提取注释中的各种实体时,我遇到了麻烦。使用以下代码:How can I split a text into sentences using the Stanford parser?
List<CoreMap> sentences = annotation.get(SentencesAnnotation.class);
不清楚如何将SentencesAnnotation.class 翻译成 C# 可以接受的东西。
【问题讨论】:
标签: java c# stanford-nlp translate