1

我正在尝试使用 wikiprep ( https://github.com/avian2/wikiprep ) 来解析 wikipedia 转储(2014 年 2 月)并从转储中生成 XXX.hgw.xml 文件。

我按照上面 Github 网站上的用法:安装所有 Perl 模块作为先决条件;成功构建并安装 wikiprep(wikiprep 程序出现在 perl5/bin 目录中)。当我执行wikiprep时,它说:

Use of the encoding pragma is deprecated at /home/tutran/perl5/bin/wikiprep line 32. Use of the encoding pragma is deprecated at /home/tutran/perl5/lib/perl5/Wikiprep/languages.pm line 7. syntax error at /home/tutran/perl5/lib/perl5/Wikiprep/Disambig.pm line 9, near "->import qw/ extractWikiLinks /" Compilation failed in require at /home/tutran/perl5/bin/wikiprep line 52. BEGIN failed--compilation aborted at /home/tutran/perl5/bin/wikiprep line 52.

这是第 9 行:

Wikiprep::Link->import qw/ extractWikiLinks /;

预期输出:我可以与 wikiprep 一起使用的选项。我也无法对该程序进行测试。我将它安装在 Ubuntu 14.04 LTS 上。我的 Perl 版本是 5.18.02。

我对 perl 语言一无所知,所以我对这里的“语法错误”无能为力!

4

2 回答 2

1

您可能需要在脚本中启用 ut8。在开始使用此模块之前放置这两行:

use utf8;
use open qw( :encoding(cp866) :std );
于 2015-05-18T12:40:57.653 回答
1

在 /usr/local/bin/ wikiprep 将第 135 行,即 (Wikiprep::Templates->import qw( %templates includeTemplates );) 更改为: Wikiprep::Templates->import(qw( %templates includeTemplates ));

并在文件 /usr/local/share/perl/5.18.2/Wikiprep/Disambig.pm 更改 Wikiprep::Link->import qw/extractWikiLinks /; 到 Wikiprep::Link->import(qw/ extractWikiLinks /);

于 2016-04-23T11:33:00.863 回答