You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@opennlp.apache.org by Abhishek Yadav <ab...@gmail.com> on 2013/12/11 12:00:43 UTC

POS Model loading Issues

Hello!

I have been trying to use POS Models for POS tagging, but while loading the
Models I get the following exception:

java.io.EOFException: Unexpected end of ZLIB input stream
at java.util.zip.InflaterInputStream.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.util.zip.ZipInputStream.read(Unknown Source)
at java.io.DataInputStream.readFully(Unknown Source)
at java.io.DataInputStream.readLong(Unknown Source)
at java.io.DataInputStream.readDouble(Unknown Source)
at
opennlp.model.BinaryFileDataReader.readDouble(BinaryFileDataReader.java:53)
at opennlp.model.AbstractModelReader.readDouble(AbstractModelReader.java:75)
at
opennlp.model.AbstractModelReader.getParameters(AbstractModelReader.java:146)
at
opennlp.perceptron.PerceptronModelReader.constructModel(PerceptronModelReader.java:69)
at
opennlp.model.GenericModelReader.constructModel(GenericModelReader.java:59)
at opennlp.model.AbstractModelReader.getModel(AbstractModelReader.java:87)
at
opennlp.tools.util.model.GenericModelSerializer.create(GenericModelSerializer.java:35)
at
opennlp.tools.util.model.GenericModelSerializer.create(GenericModelSerializer.java:31)
at opennlp.tools.util.model.BaseModel.loadModel(BaseModel.java:231)
at opennlp.tools.util.model.BaseModel.(BaseModel.java:190)
at opennlp.tools.postag.POSModel.(POSModel.java:86)
at nlpcheck.NlpPOC.POSTag(NlpPOC.java:54)
at nlpcheck.NlpPOC.main(NlpPOC.java:86)

I have tried loading the tokenizaton model (en-token.bin) and Its loading
and working fine.

Following is java source code that I am using to load Model:

InputStream is = new FileInputStream(MODEL_PATH);
POSModel model = new POSModel(is);

I have downloaded the models (en-pos-perceptron.bin,en-pos-maxent.bin) from
http://www.opennlp.org/models-1.5/. <http://www.opennlp.org/models-1.5/>

Re: POS Model loading Issues

Posted by Jörn Kottmann <ko...@gmail.com>.
Hello,

the model file you are trying to load is damaged.

HTH,
Jörn


On 12/11/2013 12:00 PM, Abhishek Yadav wrote:
> Hello!
>
> I have been trying to use POS Models for POS tagging, but while loading the
> Models I get the following exception:
>
> java.io.EOFException: Unexpected end of ZLIB input stream
> at java.util.zip.InflaterInputStream.fill(Unknown Source)
> at java.util.zip.InflaterInputStream.read(Unknown Source)
> at java.util.zip.ZipInputStream.read(Unknown Source)
> at java.io.DataInputStream.readFully(Unknown Source)
> at java.io.DataInputStream.readLong(Unknown Source)
> at java.io.DataInputStream.readDouble(Unknown Source)
> at
> opennlp.model.BinaryFileDataReader.readDouble(BinaryFileDataReader.java:53)
> at opennlp.model.AbstractModelReader.readDouble(AbstractModelReader.java:75)
> at
> opennlp.model.AbstractModelReader.getParameters(AbstractModelReader.java:146)
> at
> opennlp.perceptron.PerceptronModelReader.constructModel(PerceptronModelReader.java:69)
> at
> opennlp.model.GenericModelReader.constructModel(GenericModelReader.java:59)
> at opennlp.model.AbstractModelReader.getModel(AbstractModelReader.java:87)
> at
> opennlp.tools.util.model.GenericModelSerializer.create(GenericModelSerializer.java:35)
> at
> opennlp.tools.util.model.GenericModelSerializer.create(GenericModelSerializer.java:31)
> at opennlp.tools.util.model.BaseModel.loadModel(BaseModel.java:231)
> at opennlp.tools.util.model.BaseModel.(BaseModel.java:190)
> at opennlp.tools.postag.POSModel.(POSModel.java:86)
> at nlpcheck.NlpPOC.POSTag(NlpPOC.java:54)
> at nlpcheck.NlpPOC.main(NlpPOC.java:86)
>
> I have tried loading the tokenizaton model (en-token.bin) and Its loading
> and working fine.
>
> Following is java source code that I am using to load Model:
>
> InputStream is = new FileInputStream(MODEL_PATH);
> POSModel model = new POSModel(is);
>
> I have downloaded the models (en-pos-perceptron.bin,en-pos-maxent.bin) from
> http://www.opennlp.org/models-1.5/. <http://www.opennlp.org/models-1.5/>
>