本文介绍了NoClassDefFoundError:opennlp/tools/chunker/ChunkerModel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试opennlp分块时遇到此错误:

Got this error while trying opennlp chunking:

这是基本代码:

import java.io.*;
import opennlp.tools.chunker.*;

public class test{
        public static void main(String[] args) throws IOException{  
                ChunkerModel model = null;
                InputStream modelIn = new FileInputStream("en-parser-chunking.bin");
                model = new ChunkerModel(modelIn);
        }
}

推荐答案

我在这里看不到任何特定于NLP的原因,因此只需检查关于NoClassDefFoundError的教程,例如:

I don't see any NLP-specific reasons here, so just check tutorials about NoClassDefFoundError, for example:

应用程序是正确的,但是Classpath环境变量是 在应用程序执行之前被覆盖."

The classpath of the application is correct, but the Classpath environment variable is overridden before the application’s execution."

相关问题.

尤其要检查类路径中是否具有适当的(只有一个)opennlp jar版本.

In particular, check that you have appropriate (and only one) version of opennlp jar in your classpath.

*导入包的所有内容(使用通配符)不是一种好方法-而是使用IDE的支持: Eclipse中的ctrl + shift + o(IDEA中的ctrl + alt + o)会自动解决所有需要的导入.

*it is not a good style to import all content of the package (by using wildcard) - instead, use IDE's support: e.g. ctrl+shift+o in Eclipse (ctrl+alt+o in IDEA) automatically resolves all needed imports.

这篇关于NoClassDefFoundError:opennlp/tools/chunker/ChunkerModel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:38