Issue1845

classification
Title: jython support for nltk how to configure
Type: behaviour Severity: normal
Components: Library Versions: 2.5.0
Milestone:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, jimmycool
Priority: Keywords:

Created on 2012-03-06.04:25:49 by jimmycool, last changed 2012-03-29.18:38:42 by amak.

Messages
msg6789 (view) Author: shubhajoy das (jimmycool) Date: 2012-03-06.04:25:48
I want to know the method by which we can acces the nltk toolkit from 
jython,whenever i am trying to import nltk it says that the nltk module is not present
msg6821 (view) Author: Alan Kennedy (amak) Date: 2012-03-19.17:46:01
What is the name of the ntlk jar file?

Is the jar file on the classpath? What is your classpath setting?

What is the package name for NLTK? How are you trying to import into jython?
msg6913 (view) Author: shubhajoy das (jimmycool) Date: 2012-03-20.04:09:10
i am using netbeans ide as my development environment we can do
everything in netbeans except the nltk tool kit

The class path for the nltk package is
C:\Python26\Lib\site-packages\nltk
the classpath for the jython package
C:\Program Files\NetBeans 6.7.1\python1\jython-2.5\Lib
the classpath for the jython package
C:\Program Files\NetBeans 6.7.1\python1\jython-2.5\Lib\sitepackages

In the java path of my jython installation i have added the nltk jar file
C:\Python26\Lib\site-packages\nltk\nltk.jar

The jython code gives error on importing nltk:
Traceback (most recent call last):
  File "C:\Documents and Settings\USER-1\My
Documents\NetBeansProjects\NewPythonProject2\src\newpythonproject2.py",
line 9, in <module>
    from nltk import *
ImportError: No module named nltk

The jython code is
from javax.swing import *
from nltk import *
frame=JFrame("Hello Jython");
label=JLabel("Hello Jython!")
frame.add(label)
frame.setSize(100,200)
frame.show()

On 3/20/12, Alan Kennedy <report@bugs.jython.org> wrote:
>
> Changes by Alan Kennedy <jython-dev@xhaus.com>:
>
>
> ----------
> assignee:  -> amak
>
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue1845>
> _______________________________________
>
msg6932 (view) Author: Alan Kennedy (amak) Date: 2012-03-20.20:46:12
I'm not sure how netbeans sets up its classpath, but I recommend

A: Finding out what the classpath setting is when you run your programs under netbeans. You can do this by executing the following code in a jython program

>>> import java
>>> java.lang.System.getProperty("java.class.path")

B: Find out where the change the CLASSPATH setting in netbeans.

C: Add an entry in the CLASSPATH which points to your nltk.jar.
msg6979 (view) Author: Alan Kennedy (amak) Date: 2012-03-29.18:38:41
Closing this issue: It's really a "jython in netbeans" support question that belongs on the jython-users list, not a bug in jython.
History
Date User Action Args
2012-03-29 18:38:42amaksetstatus: open -> closed
resolution: works for me
messages: + msg6979
2012-03-20 20:46:12amaksetmessages: + msg6932
2012-03-20 04:09:10jimmycoolsetmessages: + msg6913
2012-03-19 21:57:16amaksetassignee: amak
2012-03-19 17:46:01amaksetnosy: + amak
messages: + msg6821
2012-03-06 04:25:49jimmycoolcreate