【问题标题】:Stanford Parser Installation Fails on Windows斯坦福解析器安装在 Windows 上失败
【发布时间】:2014-02-18 23:43:46
【问题描述】:

编辑: 让我知道什么是“rake 设置”?

这是我尝试让 Windows 7 上的 stanford 解析器与 python 一起工作的第二天。我偶然发现了这种安装方式——使用这个python接口——http://projects.csail.mit.edu/spatial/Stanford_Parser

在安装说明中,他们需要使用 rake 文件设置,但是当我在 Windows 7 中使用命令提示符时,导航到 3rdParty/jpype 目录并输入“rake setup”时出现错误。

We developed a python interface to the Stanford Parser.  It uses JPype
to create a Java virtual machine and convert between python and Java.
Most of the code is about getting the Stanford Dependencies, but it's
easy to add API to call any method on the parser.

JPype is included; you can set compile it by running "rake setup" in
3rdParty/jpype.  The Stanford Parser can be downloaded and installed
by running "rake download; rake setup" in 3rdParty/stanford-parser".
Otherwise set the environment variable STANFORD_PARSER_HOME to the
location of the installed directory.  It loads the grammar file from
the unzipped version, because the load is a few seconds faster.  If
you haven't gunzipped the .ser file you will get an error.

To see how to use it, look at parser_test.py.

【问题讨论】:

  • 这在我看来不像是一条错误消息。
  • 如果您显示实际的错误消息可能会有所帮助...
  • 命令提示符说:“rake”没有被识别。顺便问一下rake安装是什么?
  • 我还是不能在这里发图片

标签: python python-2.7 nlp jython stanford-nlp


【解决方案1】:

听起来 Rake 不在您的 PATH 中。

什么是耙子?

Rake 是使用 Ruby 编写的构建自动化工具。如果您曾经使用过 UNIX make,则类似,只是您使用 Ruby 编写构建文件。

如果你不知道make 是什么,想象一下一个非常漂亮的批处理文件,它可以构建一个程序,只不过它只重建自上次构建以来发生的变化。

如何安装 Rake?

安装 Ruby 和 RubyGems

使用 RubyInstaller

转到 http://rubyinstaller.org/downloads/ 并下载 Ruby 1.9.3 安装程序。现在运行它。像任何其他安装程序一样继续,直到您到达允许您选择安装目录的屏幕。在这里,选择标有Add Ruby executables to your PATH 的框。这是一张图片:


(来源:forwardhq.com

使用巧克力

通过打开命令提示符并运行以下长命令来下载并安装 Chocolatey:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

完成后,运行以下命令(您可能需要重新启动命令提示符窗口):

cinst rubygems

请注意,这些可能需要一段时间才能显示出移动的迹象。

安装耙子

安装 Ruby 后,弹出命令提示符并运行:

gem install rake

瞧!现在rake 应该可以正常工作了。

【讨论】:

  • 谢谢我设法安装它没有任何错误,但在我输入 rake setup = command failed with status 127 后仍然有错误
  • 我不确定人们是不是很奇怪projects.csail.mit.edu/spatial/Stanford_Parser。如果他们不想让我使用他们的软件,那么根本不应该把它放在网上。不引诱我安装无法安装的愚蠢软件,也浪费我和你的时间。
  • @Brana: 127?那是 Linux 退出代码,而不是 Windows。您是否在 Posix shell 中,例如 MinGW 或 Cygwin?
  • 解压相关
  • @Brana:你能发布完整的错误信息吗?不要失去希望。每当您在 Windows 上安装开发人员的东西时,总是需要 27 次尝试和 9 次生命。哦,MS的魅力……
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多