java - Java 斯坦福图书馆异常

标签 java exception stanford-nlp

我正在开发一个 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/

相关文章:

java - 使用 Action 监听器设置目录

java - 在 Android 中使用 TimerTask

java - 为什么即使使用迭代器也会出现 ConcurrentModificationException?

java - 在没有异常类的java中创建自定义异常?

java - 使用 CoreNLP 进行法语依存解析

java - model.ser.gz 位于斯坦福 corenlp 的哪里?

java - 第二次点击 Android 主屏幕小部件不起作用

java - 到底什么是资源泄漏?

javax.naming.NoIntialContextException : for JNDI DataSource

java - 使用 OpenJDK 11.0.4 编译 CoreNLP 时出错