关于perl:运行SPADE时如何解决错误

How to solve the errors when I run SPADE

我运行了SPADE程序包,并根据文档引用了Charniak Parser,并为$CHP变量编辑了spade.pl,但是它不起作用。它仍然会引发如下异常

1
2
sh: 1: /home/khaing/Downloads/CharniakParser/parseIt: not found
system /home/khaing/Downloads/CharniakParser/parseIt -LEn /home/khaing/Downloads/CharniakParser/DATA/ /home/khaing/Documents/test.txt > /home/khaing/Documents/test.txt.chp failed: 32512 at /home/khaing/Downloads/SPADE/bin/spade.pl line 38.

例外是未找到parseIt。当我查看Charniak Parser时,它有五个文件夹:CVSecstuffDATATRAINPARSE。我没有看到parseIt。但是我在PARSE文件夹中找到了pareIt.c,所以我编辑了CharniakParser / PARSE / parseIt路径,但是它仍然有错误。


您链接说的说明

Edit spade.pl in the bin/ directory; set the value for the $CHP variable to the directory path for Charniak's parser

因此,如果SPADE无法找到parseIt,则您已将$CHP设置为错误的路径。

如果没有parseIt二进制文件,但是您有parseIt.c,那么我猜您必须构建它。查看Charniak Parser

的文档


以下是获取最新版本的Charniak解析器并进行构建的具体步骤:

  • 在要安装解析器的目录中建立一个目录(其中/path/to是要放置解析器的目录-在您的情况下,可能是/home/Khaing)

    1
    2
    shell% mkdir /path/to/bllip-parser
    shell% cd /path/to/bllip-parser/

  • 下载并提取Charniak Parser的最新版本:

    1
    2
    3
    4
    shell% wget https://github.com/BLLIP/bllip-parser/archive/master.zip
    shell% unzip master.zip
    shell% mv bllip-parser-master/* bllip-parser-master/.* .
    shell% rmdir bllip-parser-master
  • 构建解析器:

    1
    shell% make PARSE
  • 确认parseIt的构建正确:

    1
    2
    shell% ls first-stage/PARSE/parseIt  
    first-stage/PARSE/parseIt

    如果运行first-stage/PARSE/parseIt,应该会看到其帮助菜单。

  • 这时,您可以将$CHP设置为指向在步骤1中创建的bllip-parser目录内部:将spade.pl中的$CHP更改为/path/to/bllip-parser/first-stage/PARSE/