将 NLTK 与 Google App Engine 结合使用
有人将 NLTK 与 GAE 一起使用吗? 从此帖子看来,GAE 不支持 NLTK(需要特殊的安装技巧。)您知道其他轻量级的类似 Python 模块吗?谢谢。
Is anyone using NLTK with GAE? From this thread it appears that GAE does not support NLTK (Special installation tricks needed.) Do you know any other lightweight similar Python module? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GAE 几乎支持任何“纯”Python 模块,这些模块不会尝试访问文件、套接字或其他系统级实用程序。您链接中的海报主要只是试图最大限度地减少它们所包含的模块数量。他们表达了一种反复试验的方法来确定其应用程序需要哪些 NLTK 模块。一种稍微快一点的方法是下载整个 NLTK 包并移入所有“.py”文件,而不是一次只移入一个。包含您不会使用的模块并没有什么大的缺点。
然而,这个过程是 GAE 的现实。任何未直接包含在 GAE 库中的模块都需要手动安装,并且需要检查它们是否与 GAE 沙箱限制存在任何偏差。 请参阅此内容。
快速浏览一下 NLTK 源代码就会发现,模块特别是依赖“mallet”可能会出现问题,因为这是编译后的java代码。
GAE supports pretty much any "pure" Python modules which don't try to access files or sockets or other system level utilities. The poster from your link was mostly just trying to minimize the number of modules they included. They expressed a trial and error approach to figuring out which NLTK modules would be needed for their application. A slightly faster approach would be to download the whole NLTK package and move in all the ".py" files rather than just one at a time. There's no big downside to including modules you won't be using.
However this process is something of a fact of life with GAE. Any modules that aren't directly included in the GAE libraries need to be installed manually, and they need to be checked for any deviations from the GAE sandbox restrictions. See this.
A quick glance at the NLTK source code suggests that modules that depend on "mallet" in particular might be problematic, since this is compiled java code.