Stanford pos tagger not displaying the output elements in Python (MAC)
Question: 
    #-*- coding:Utf-8 -*-
    import sys
    reload(sys)
    sys.setdefaultencoding('utf8')
    import os
    java_path = "/usr/libexec/java_home" # replace this
    os.environ['JAVAHOME'] = java_path
    
    from nltk.tag.stanford import POSTagger
    
    french_postagger = POSTagger("stanford-postagger-full-2014-10-26/models/french.tagger", "stanford-postagger-full-2014-10-26/stanford-postagger.jar", encoding="utf-8")
    english_postagger = POSTagger("stanford-postagger-full-2014-10-26/models/english-bidirectional-distsim.tagger", "stanford-postagger-full-2014-10-26/stanford-postagger.jar", encoding="utf-8")
    
    
    print french_postagger.tag("siddhartha is a good boy".split())
    

the result is as follows:

    
    
    [('', u'/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home')]
    

instead I need to see the words and their tags.


Answer: The problem is this part of your code:

    
    
    java_path = "/usr/libexec/java_home" # replace this
    os.environ['JAVAHOME'] = java_path
    

Where did that code from? It looks like you should replace it. If your setup
is like mine, changing that first line to `java_path = "/usr/bin/java"` fixes
the problem. Actually, if your setup is like mine, just **deleting those two
lines completely** fixes the problem (while including them reproduces it):

    
    
    from nltk.tag.stanford import POSTagger
    french_postagger = POSTagger("models/french.tagger", "stanford-postagger.jar", encoding="utf-8")
    english_postagger = POSTagger("models/english-bidirectional-distsim.tagger", "stanford-postagger.jar", encoding="utf-8")
    
    print french_postagger.tag("siddhartha is a good boy".split())
    > [[(u'siddhartha', u'ADV'), (u'is', u'VPP'), (u'a', u'V'), (u'good', u'ET'), (u'boy', u'ET')]]
    

