gpt4 book ai didi

java - 异常:缺少manifest.properties

转载 作者:行者123 更新时间:2023-12-02 05:56:21 25 4
gpt4 key购买 nike

我是opennlp的新手,当我执行以下代码时,我遇到了缺少manifest.properties!异常,请告诉我避免这种情况的建议。

   public class PrePostProcessing_Peregrine  {


public Map<String,Set<String>> btntMap;
public Map<String, String> fishMap;
public SentenceModel sModel;
public SentenceDetectorME sentDet;
public Map<String,Set<String>> topBottomTermSet;

public PrePostProcessing_Peregrine() throws IOException {


FileInputStream str=new FileInputStream("/home/rajendraprasad.yk/Desktop/data/en-sent.bin");
System.out.println(str+"===================>");
SentenceModel sModel = new SentenceModel(str);
System.out.println("===================model =================>"+sModel);
sentDet = new SentenceDetectorME(sModel);
System.out.println("===================>sentDet "+sentDet);
System.err.println("Sentence Detector Initialized");

异常(exception)是:

opennlp.tools.util.InvalidFormatException: Missing the manifest.properties!
at opennlp.tools.util.model.BaseModel.validateArtifactMap(BaseModel.java:217)
at opennlp.tools.sentdetect.SentenceModel.validateArtifactMap(SentenceModel.java:78)
at opennlp.tools.util.model.BaseModel.<init>(BaseModel.java:142)
at opennlp.tools.sentdetect.SentenceModel.<init>(SentenceModel.java:73)
at com.molcon.Text_Mining.PrePostProcessing_Peregrine.<init>(PrePostProcessing_Peregrine.java:66)
at com.molcon.Text_Mining.TextMining.peregrineRun(TextMining.java:207)
at com.molcon.Text_Mining.TextMining.process_journals_for_Mining(TextMining.java:108)

我在 FileInputStream modelIn = new FileInputStream("/home/rajendraprasad.yk/Desktop/data/en-sent.bin"); 处犯了错误现在我改为InputStream modelIn = new FileInputStream("/home/rajendraprasad.yk/Desktop/data/en-sent.bin");通过此更改,我没有收到任何异常,但无法从 SentenceModel 加载文件。

当我执行这行SentenceModel sModel = new SentenceModel(modelIn);时我没有收到任何回复,请帮忙

最佳答案

据我所知,有两个可能的原因:

  • 您使用的模型已损坏,请尝试重新下载
  • 您使用的模型和 OpenNLP 库的版本不匹配。正如我从官方网站上看到的,模型是特定于版本的,因此您应该尝试了解是否属于您的情况,并采取相应的行动。

关于java - 异常:缺少manifest.properties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23053133/

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