0

I have nltk installed on my system. But I am unable to use Stanford POS Tagger using the following code.

    from nltk.tag.stanford import StanfordTagger
    st = StanfordTagger('bidirection-distsim-wsj-0-18.tagger')

I have even tried the documented code.

    from nltk.tag import StanfordPOSTagger
    st = StanfordPOSTagger('english-bidirectional-distsim.tagger')

this error was popping.

NLTK was unable to find ! Set the CLASSPATH environment variable.

I already have stanford.py in my nltk module

Affan
  • 85
  • 2
  • 9
  • see http://stackoverflow.com/questions/30821188/python-nltk-pos-tag-not-returning-the-correct-part-of-speech-tag/30823202#30823202 – alvas Jul 02 '15 at 13:48
  • you have to specify the `path_to_model` and `path_to_jar` when creating the `nltk.pos.stanford.POSTagger` – alvas Jul 02 '15 at 13:50
  • do i need to specify model and path to jar to the stanford jar folder of pos tagger – Affan Jul 03 '15 at 06:44
  • yes, you have to. Follow the e.g. from http://stackoverflow.com/questions/30821188/python-nltk-pos-tag-not-returning-the-correct-part-of-speech-tag/30823202#30823202 – alvas Jul 03 '15 at 06:48
  • I am now getting error at this -> st.tag(text.split()) – Affan Jul 03 '15 at 06:54
  • do i have to use java 1.8 for the pos tagger to work . And thanks for the link. – Affan Jul 03 '15 at 06:55

0 Answers0