Cannot open :/root/ROUGE/RELEASE-1.5.5/data/smart_common_words.txt

错误信息

rouge使用过程中,上报如下错误:
Cannot open :/root/ROUGE/RELEASE-1.5.5/data/smart_common_words.txt

定位分析

定位到出错的位置,ROUGE-1.5.5.pl文件第475行:

open(STOP,$stopwords)||die "Cannot open $stopwords\n";

结合错误信息,发现$stopwords变量多了一个 ': ’
文件中,变量的定义代码块为:

if(defined($opt_e)) {
  $stopwords="$opt_e/smart_common_words.txt";
  $wordnetDB="$opt_e/WordNet-2.0.exc.db";
}
else {
  if(exists($ENV{"ROUGE_EVAL_HOME"})) {
    $stopwords="$ENV{\"ROUGE_EVAL_HOME\"}/smart_common_words.txt";
    $wordnetDB="$ENV{\"ROUGE_EVAL_HOME\"}/WordNet-2.0.exc.db";
  }
  elsif(exists($ENV{"RED_EVAL_HOME"})) {
    $stopwords="$ENV{\"RED_EVAL_HOME\"}/smart_common_words.txt";
    $wordnetDB="$ENV{\"RED_EVAL_HOME\"}/WordNet-2.0.exc.db";
  }
  else {
    # if no environment variable exists then assume data files are in the current directory
    $stopwords="smart_common_words.txt";
    $wordnetDB="WordNet-2.0.exc.db";
  }
}

我们添加的环境变量为:

export ROUGE_EVAL_HOME=$ROUGE_EVAL_HOME:/root/ROUGE/RELEASE-1.5.5/data

推测是perl在解析环境变量时出了问题,多解析了一个’:’。

解决方案

由于本人对perl语言不熟悉,只能从其它方面解决,目前只想到两种解决方式:

1,执行脚本ROUGE-1.5.5.pl 时,添加选项:

-e /root/ROUGE/RELEASE-1.5.5/data

2,将环境变量修改为

export ROUGE_EVAL_HOME=/root/ROUGE/RELEASE-1.5.5/data

rouge安装教程参考:
Ubuntu安装配置ROUGE

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值