3

I've read through the FAQ for Jython and this post Jython and python modules but am not sure how I can determine if a module is written purely in C or Python.

The problem I'm facing is mentioned here http://old.nabble.com/using-NLTK-in-Jython-td28520926.html

Can anyone that has done this shed some light on this? I'm new to Jython.

Thanks,

2 Answers 2

2

Did you add C:\Python26\Lib\site-packages\nltk to sys.path as stated in your question? It should really be C:\Python26\Lib\site-packages, which is the directory containing nltk. If you don't want to add the entire site-packages, try moving the nltk folder to another folder.

Sign up to request clarification or add additional context in comments.

Comments

1

I was using Eclipse, and including the path to the root dir (nltk or site-packages) did not work. However, making jar files of both the nltk directory and the yaml directory did work. Example,

jar -cf nltk.jar /Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site-packages/nltk
jar -cf yaml.jar /Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site-packages/yaml

Then in my Jython code I had to add the jar files, which I added to the project's lib dir,

sys.path.append("/Users/peter/phd/lib/yaml.jar")
sys.path.append("/Users/peter/phd/lib/nltk.jar")

In addition to this I had to use the Eclipse import archive file feature to get it to see the NLTK modules.

Had a bit of a struggle with this, so hope it saves someone else some time.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.