简体   繁体   English

PyPy是否适用于NLTK?

[英]Does PyPy work with NLTK?

Does PyPy work with NLTK, and if so, is there an appreciable performance improvement, say for the bayesian classifier? PyPy是否适用于NLTK,如果是这样,那么对于贝叶斯分类器来说,是否有明显的性能提升?

While we're at it, do any of the other python environments (shedskin, etc) offer better nlkt performance than cpython? 虽然我们正在使用它,但是其他任何python环境(shedskin等)都提供比cpython更好的nlkt性能吗?

At least some of NLTK does work with PyPy and there is some performance gain, according to someone on #pypy on freenode. 根据freenode上的#pypy上的某些人的说法,至少有一些NLTK可以与PyPy一起工作并且有一些性能提升。 Have you run any tests? 你做过任何测试吗? Just download PyPy from pypy.org/download.html and instead of "time python yourscript.py data.txt" type "time pypy yourscript.py data.txt". 只需从pypy.org/download.html下载PyPy,而不是“time python yourscript.py data.txt”,输入“time pypy yourscript.py data.txt”。

I got a response via email (Seo, please feel free to respond here) that said: 我通过电子邮件收到回复(Seo,请随时回复),说:

The main issues are: 主要问题是:

PyPy implements Python 2.5. PyPy实现了Python 2.5。 This means adding "from future import with_statement" here and there, rewriting usages of property.setter, and fixing up new in 2.6 library calls like os.walk. 这意味着在这里和那里添加“from future import with_statement”,重写property.setter的用法,并在os.walk等2.6库调用中修复新内容。

NLTK needs PyYAML. NLTK需要PyYAML。 Simply symlinking (or copying) stuffs to pypy-1.4/site-packages work. 只需将符号链接(或复制)到pypy-1.4 / site-packages就可以了。

And: 和:

Do you have NLTK running with PyPy, and if so are you seeing performance improvements? 你有运行PyPy的NLTK吗?如果有的话你是否看到了性能提升?

Yes, and yes. 是的,是的。

So apparently NLTK does run with PyPy and there are performance improvements. 显然NLTK确实与PyPy一起运行,并且有性能改进。

You can run nltk with pypy now. 你现在可以用pypy运行nltk。 There's a benchmark under pypy 1.8 , although later releases (currently pypy 2.0 is the latest) will perform better still. 在pypy 1.8下一个基准测试 ,虽然后来的版本(目前pypy 2.0是最新的)仍将表现更好。 nltk runs its unit tests under pypy these days, so the nltk developers are ensuring it works. nltk这些天在pypy下运行其单元测试 ,因此nltk开发人员确保它的工作原理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM