From: Jinseung Eu <jin...@li...> - 2009-03-15 11:56:51
|
Hello! I am having a trouble using a program called Stanford Parser 1.6.1 (To unzip it, you may have to unzip it twice): (http://www-nlp.stanford.edu/downloads/lex-parser.shtml#Download). I have posted several messages but have not received a full solution. So I am posting it again with all updates. I renamed the unzipped folder as "stanford-parser-2008" and put it inside the jython 2.2.1 folder and added the path as follows: >> import sys >> sys.path.append("stanford-parser-2008\\src") >> Then I accessed the following packages within src, and this worked: >> import edu.stanford.nlp.parser >> But when I try to access a class within it I get an error: >> import edu.stanford.nlp.parser.Parser Traceback ... File "<console>".... ImportError: no module named Parser >> from edu.stanford.nlp.parser import Parser Traceback ... File "<console>".... ImportError: cannot import name Parser This problem was encountered by someone else two years ago (http://www.nabble.com/Importing-non-builtin-java-modules-to8957425.html#a8999193) Here Charlie resolves the issue by adding "stanford-parser.jar" to sys.path. --> But this doesn't work for me. I don't know why. Do I need to put the unzipped folder somewhere else? Below, Jeff suggests I need to compile the "Parser.java" file to "Parser.class" file. --> I tried the compilation but failed (Perhaps I put the file in the wrong place for compilation, or the file is not meant to be compiled). --> Also I am not entirely convinced that a .class file is necessary here. Jython can import .java files like System.java (in java.lang) and Random.java (in java.util). Then, why do I have to have a .class file for the Stanford parser? / Can someone please help me get solve this puzzle? Thanks a lot. |