2

I am working through this Stanford POS tagger tutorial. I am doing it in Scala but I do not think that this matters.

The line that produces the error is

val tagger=new MaxentTagger("/Users/user1/Documents/taggers/left3words-wsj-0-18.tagger")

and the error is

edu.stanford.nlp.io.RuntimeIOException: java.io.StreamCorruptedException: invalid stream header: 0003CBE8

The filepath is correct.

user1893354
  • 5,778
  • 12
  • 46
  • 83

3 Answers3

2

I had the same problem =/

You should put your "taggers" folder inside project resources folder, and then your path will look this way: "taggers/NAME_OF_MODEL.tagger" (only "taggers" folder should be in the path).

Gwenc37
  • 2,064
  • 7
  • 18
  • 22
zegoline
  • 574
  • 2
  • 8
  • 21
1

By default the tagger treats the model file path as a classpath-relative resource path, but it also accepts a fully qualified URL:

val tagger=new MaxentTagger("file:/Users/user1/Documents/taggers/left3words-wsj-0-18.tagger")
Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
1

That usually happens when trying to use a model that was trained for a different tagger version. Make sure you are using the models distributed with the 3.3.1 tagger.

I faced the same problem once. Then I realized that the jar version I was using was from 3.3.1 release. And the model was from 3.2.0. I removed the 3.2.0 model files and replaced them with 3.3.1.

Hope this helps.

Atst
  • 11
  • 3