MaxentTagger 中的 NoSuchMethodError

发布于 2025-01-03 07:44:00 字数 561 浏览 4 评论 0原文

我在代码中使用 stanford Parser。我已经在项目中添加了所有相关的库。当我在控制台上运行代码时,它工作得很好。但是,在使用选项“将所需的库复制到生成的 JAR 旁边的子文件夹中”创建源的“可运行 jar”并在命令提示符上运行相同的命令后,它会抛出错误:

线程“Thread-2”中出现异常java.lang.NoSuchMethodError:
edu.stanford.nlp.process.DocumentPreprocessor.(Ljava/io/Reader;)V 在 edu.stanford.nlp.tagger.maxent.MaxentTagger.tokenizeText(MaxentTagger.java:852) 在 edu.stanford.nlp.tagger.maxent.MaxentTagger.tokenizeText(MaxentTagger.java:837) 我已经在类路径中提供了所有必需的库。 MaxentTagger 中也存在 tokenizeText 方法。请提出一些解决方案。

I am using stanford Parser in my code. I have added all the relevent libraries in the project. When I run my code on console it works perfectly fine. But after creating a 'runnable jar' of the source with an option "Copy required libraries into a subfolder next to the generated JAR" and run the same on commmand promt it throws an error:

Exception in thread "Thread-2" java.lang.NoSuchMethodError:
edu.stanford.nlp.process.DocumentPreprocessor.(Ljava/io/Reader;)V
at edu.stanford.nlp.tagger.maxent.MaxentTagger.tokenizeText(MaxentTagger.java:852)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.tokenizeText(MaxentTagger.java:837)
at I have provided all the required libraries in classpath. Also the method tokenizeText is present in the MaxentTagger. Please suggest some solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜雨飘雪 2025-01-10 07:44:00

这几乎肯定意味着您组合了解析器和标记器的不兼容版本。例如,插入到 jar 文件中的标记器的版本可能与在命令行上运行代码时选取的版本不同。您使用什么版本的解析器和标记器?从堆栈跟踪中的行号来看,它似乎不是最新版本。

This almost certainly means that you have combined incompatible releases of the parser and tagger. E.g., perhaps the version of the tagger being inserted into the jar file is different to the one picked up when you run the code on the command-line. What versions of the parser and tagger are you using? From the line numbers in the stacktrace, it appears not to be the latest version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文