开发者

Cannot import edu.stanford.nlp - Stanford parser with jython problem

Can someone help me out with the stanford parser from http://nlp.stanford.edu/software/lex-parser.shtml?

I've 开发者_如何学运维only downloaded and unzipped the parser. I've also installed the jython fully but i cannot parse a sentence, it seems like i've installed some modules or something. http://wiki.python.org/jython/InstallationInstructions

>>> import sys
>>> sys.path.append('~/standford-parser-2010-11-30/stanford-parser-2011-11-30.jar')
>>> from java.io import CharArrayReader
>>> from edu.stanford.nlp import *
Traceback (innermost last):
  File "<console>", line 1, in ?
ImportError: no module named edu

Is there more installation procedures other than unzipping it and importing it in jython?


You have a typo in your sys.append statement. The filename says 2011 when it should be 2010:

import sys
sys.path.append('./stanford-parser-2010-11-30/stanford-parser-2010-11-30.jar')
from edu.stanford.nlp import *
print fsm
<java package edu.stanford.nlp.fsm 1>


You might also look here for some starting off example code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜