gpt4 book ai didi

java - 使用开源版本的CoreNLP时无法加载OpenIE模型

转载 作者:行者123 更新时间:2023-12-01 09:56:08 28 4
gpt4 key购买 nike

我从this page下载了coreNLP的源码以及 README 文件中推荐的型号。我在 Eclipse 中创建一个新项目并尝试运行 openie,它返回以下异常:

Exception in thread "main" edu.stanford.nlp.io.RuntimeIOException: Could not load clause splitter model at edu/stanford/nlp/models/naturalli/clauseSearcherModel.ser.gz
at edu.stanford.nlp.naturalli.OpenIE.<init>(OpenIE.java:201)
at edu.stanford.nlp.pipeline.AnnotatorImplementations.openie(AnnotatorImplementations.java:272)
at edu.stanford.nlp.pipeline.AnnotatorFactories$20.create(AnnotatorFactories.java:654)
at edu.stanford.nlp.pipeline.AnnotatorPool.get(AnnotatorPool.java:89)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(StanfordCoreNLP.java:403)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:142)
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<init>(StanfordCoreNLP.java:138)
at edu.stanford.nlp.naturalli.demo.Demo.main(Demo.java:37)
Caused by: java.io.InvalidClassException: edu.stanford.nlp.naturalli.ClauseSplitterSearchProblem$8; local class incompatible: stream classdesc serialVersionUID = 4145523451314579506, local class serialVersionUID = -7360029270983346606
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:621)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1623)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at edu.stanford.nlp.io.IOUtils.readObjectFromURLOrClasspathOrFileSystem(IOUtils.java:325)
at edu.stanford.nlp.naturalli.ClauseSplitter.load(ClauseSplitter.java:283)
at edu.stanford.nlp.naturalli.OpenIE.<init>(OpenIE.java:196)
... 7 more

最佳答案

我已完成以下步骤:

  1. 从 GitHub 克隆存储库:https://github.com/stanfordnlp/CoreNLP.git

  2. 下载最新的模型 jar:http://nlp.stanford.edu/software/stanford-corenlp-models-current.jar

  3. cd CoreNLP ; Ant

  4. 此时您应该已经在 GitHub 上构建了最新版本的代码

  5. 设置 CLASSPATH 以包含 CoreNLP/classes、CoreNLP/lib 和最新模型 jar

  6. 运行此命令:java -Xmx4g edu.stanford.naturalli.OpenIE

它运行良好,所以我认为我们当前分发的内容没有任何问题。

关于java - 使用开源版本的CoreNLP时无法加载OpenIE模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37199227/

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