stanford库中的异常与java

时间:2014-03-31 11:23:05

标签: java exception stanford-nlp

我正在研究java项目,使用Standford 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 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

请帮助我。

1 个答案:

答案 0 :(得分:2)

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

您可以从此处下载:http://sourceforge.net/projects/jollyday/