setup : python 3.4 on anaconda , windows 10 ipec 64 bit vm nltk version 3.0.2, stanford-parser-3.5.2
i implemented function yesterday , got working. here code :
def parnow(temp_in):     import os     nltk.parse import stanford     java_path = "/program files (x86)/java/jdk1.8.0_05/bin/java.exe"      os.environ['stanford_parser'] = '/stanford'     os.environ['stanford_models'] = '/stanford'     os.environ['javahome'] = java_path      parser = stanford.stanfordparser(model_path="/stanford/parser/edu/stanford/nlp/models/lexparser/englishpcfg.ser.gz")     sentences = parser.raw_parse_sents((temp_in))      mylistiterator in sentences:         t in mylistiterator:             return(t)   this working fine yesterday , made couple of test runs. morning, when ran same function, example parnow("this test.") error message saying "nltk unable find gs file!" . 
this i've tried :
- checked path file spelling errors or alike.
 - reloaded module, reloaded kernel, restarted spyder
 - re-copied path , pasted again.
 - replaced file backup copy.
 - checked code history saw no changes made.
 - placed character in path. when this, "raise oserror". when undo change, missing file error again, shows me nltk somehow sees file afterall.
 - used 
c:\\stanford\\parser\\edu\\stanford\\nlp\\models\\lexparser\\englishpcfg.ser.gzpath. - went step step without function , confirmed each line make sure no errors present before setting parser.
 - copied file folder, changed path.
 - changed file name.
 - checked permissions of folder / file.
 - checked if file in use/locked reason.
 
[edit] error message :
parnow("this last resort") out[3]: tree('root', [tree('np', [tree('nnp', ['t'])])])traceback (most recent call last):    file "c:\anaconda3\lib\site-packages\ipython\core\formatters.py", line 339, in __call__     return method()    file "c:\anaconda3\lib\nltk\tree.py", line 726, in _repr_png_     subprocess.call([find_binary('gs', binary_names=['gswin32c.exe', 'gswin64c.exe'], env_vars=['path'], verbose=false)] +    file "c:\anaconda3\lib\nltk\internals.py", line 546, in find_binary     binary_names, url, verbose))    file "c:\anaconda3\lib\nltk\internals.py", line 540, in find_binary_iter     url, verbose):    file "c:\anaconda3\lib\nltk\internals.py", line 519, in find_file_iter     raise lookuperror('\n\n%s\n%s\n%s' % (div, msg, div))  lookuperror:   =========================================================================== nltk unable find gs file! use software specific configuration paramaters or set path environment variable. ===========================================================================       
 
  
Comments
Post a Comment