问题
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.
回答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")
回答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).
回答3:
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.
来源:https://stackoverflow.com/questions/22048384/invalid-stream-header-with-stanford-nlp-library