让 Python 的 nltk.wordnet 模块为 Jython 工作
我已阅读 Jython 的常见问题解答和这篇文章 Jython 和 python 模块,但我不确定我如何确定一个模块是纯粹用 C 还是 Python 编写的。
我面临的问题在这里提到 http://old.nabble .com/using-NLTK-in-Jython-td28520926.html
任何完成此操作的人都可以对此有所了解吗?我是 Jython 新手。
谢谢,
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,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否按照问题中所述将
C:\Python26\Lib\site-packages\nltk
添加到sys.path
中?它实际上应该是C:\Python26\Lib\site-packages
,这是包含nltk
的目录。如果您不想添加整个site-packages
,请尝试将nltk
文件夹移动到另一个文件夹。Did you add
C:\Python26\Lib\site-packages\nltk
tosys.path
as stated in your question? It should really beC:\Python26\Lib\site-packages
, which is the directory containingnltk
. If you don't want to add the entiresite-packages
, try moving thenltk
folder to another folder.我使用的是 Eclipse,并且包含根目录(nltk 或 site-packages)的路径不起作用。但是,制作 nltk 目录和 yaml 目录的 jar 文件确实有效。例如,
然后在我的 Jython 代码中,我必须添加 jar 文件,并将其添加到项目的 lib 目录中,
除此之外,我还必须使用 Eclipse 导入存档文件功能来让它查看 NLTK 模块。
对此有些挣扎,所以希望它可以节省其他人的时间。
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,
Then in my Jython code I had to add the jar files, which I added to the project's lib dir,
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.