gpt4 book ai didi

java - Java 斯坦福图书馆异常

转载 作者:行者123 更新时间:2023-12-02 05:59:53 30 4
gpt4 key购买 nike

我正在开发一个 java 项目,使用斯坦福 nlp 库从文本中提取主语、谓语、宾语。我写了这段代码

Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
String text = "the quick fox jumps over the lazy dog";

Annotation document = new Annotation(text);

pipeline.annotate(document);

List<CoreMap> sentences = document.get(SentencesAnnotation.class);

for (CoreMap sentence: sentences) {
for (CoreLabel token: sentence.get(TokensAnnotation.class)) {
String word = token.get(TextAnnotation.class);
String pos = token.get(PartOfSpeechAnnotation.class);
String ne = token.get(NamedEntityTagAnnotation.class);
}
Tree tree = sentence.get(TreeAnnotation.class);

SemanticGraph dependencies =
sentence.get(CollapsedCCProcessedDependenciesAnnotation.class);
}

Map<Integer, CorefChain> graph = document.get(CorefChainAnnotation.class);

我有一个异常(exception):

Exception in thread "main" java.lang.NoClassDefFoundError: de/jollyday/HolidayManager.
at test_ir.Main.main(Main.java:88)
Caused by: java.lang.ClassNotFoundException: de.jollyday.HolidayManager

最佳答案

确保 jollyday jar 文件在运行时位于类路径中。这应该可以解决你的问题。

您可以从这里下载:http://sourceforge.net/projects/jollyday/

关于java - Java 斯坦福图书馆异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22760291/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com