Stanford POS tagger in Java
-
21-09-2019 - |
Question
I'm trying this:
Sentence<TaggedWord> taggedString = MaxentTagger.tagStringTokenized("here is a string to tag");
which gives me:
Error: \u\nlp\data\pos-tagger\wsj3t0-18-left3words\left3words-wsj-0-18.tagger (The system cannot find the path specified)
I'm using Stanford's POS tagger.
What can I do to overcome this problem?
Solution
It seems you first have to instantiate a tagger passing the included file:
new MaxentTagger("models/left3words-wsj-0-18.tagger");
Which is pretty nasty as the tagging method used later is static:
MaxentTagger.tagStringTokenized("here is a string to tag");
I also had to pass -Xmx256m
to make it run with that setup.
OTHER TIPS
It's saying that it can't find that path. So, does it exist on your machine?
Note that the slashes are backslashes - does your OS support backslash as a file separator?
Also note that it's an absolute path - is that intended?
If all else is OK, does the file exist?
Edit: if not, you should download it here (http://github.com/tiendung/ruby-nlp/blob/master/left3words-wsj-0-18.tagger), place it in the path that the system is specifying, and see what happens.