0

I've been trying to install Python package pyrouge for a while. Finally by following all these steps here I installed. It was the most helpful answer related to pyrouge I have seen so far. It does not give any error, I can import Rouge155 successfully. However when I try to do the same test as in step 8(with the same code), I got FileNotFoundError. I compared the given output in the answer and my output, and I think it can not find the file 'rouge_conf.xml'. I checked, the file was created. Since I don't have enough rep, I can not ask this as a comment, so I have to open a new question. Do you know what is the problem exactly, and how to fix? (win10, python 3.7). Thanks in advance for any help.

This is the error I get(you can compare with the link):

2019-06-18 21:14:14,361 [MainThread  ] [INFO ]  Writing summaries.
2019-06-18 21:14:14,362 [MainThread  ] [INFO ]  Processing summaries. Saving system files to C:\Users\admin\AppData\Local\Temp\tmp86sm5x3u\system and model files to C:\Users\admin\AppData\Local\Temp\tmp86sm5x3u\model.
2019-06-18 21:14:14,363 [MainThread  ] [INFO ]  Processing files in systems.
2019-06-18 21:14:14,363 [MainThread  ] [INFO ]  Processing text.001.txt.
2019-06-18 21:14:14,365 [MainThread  ] [INFO ]  Saved processed files to C:\Users\admin\AppData\Local\Temp\tmp86sm5x3u\system.
2019-06-18 21:14:14,366 [MainThread  ] [INFO ]  Processing files in references.
2019-06-18 21:14:14,367 [MainThread  ] [INFO ]  Processing text.A.001.txt.
2019-06-18 21:14:14,369 [MainThread  ] [INFO ]  Saved processed files to C:\Users\admin\AppData\Local\Temp\tmp86sm5x3u\model.
2019-06-18 21:14:14,374 [MainThread  ] [INFO ]  Written ROUGE configuration to C:\Users\admin\AppData\Local\Temp\tmpirzhwufa\rouge_conf.xml
2019-06-18 21:14:14,374 [MainThread  ] [INFO ]  Running ROUGE with command perl  D:\study\ROUGE-1.5.5\ROUGE-1.5.5.pl -e D:\study\ROUGE-1.5.5\data -c 95 -2 -1 -U -r 1000 -n 4 -w 1.2 -a -m C:\Users\admin\AppData\Local\Temp\tmpirzhwufa\rouge_conf.xml
Traceback (most recent call last):

  File "<ipython-input-21-732ec1e402fb>", line 1, in <module>
    runfile('C:/Users/admin/Desktop/somefolder/untitled0.py', wdir='C:/Users/admin/Desktop/somefolder')

  File "C:\Users\admin\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Users\admin\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/admin/Desktop/somefolder/untitled0.py", line 16, in <module>
    output = r.convert_and_evaluate()

  File "C:\Users\admin\Anaconda3\lib\site-packages\pyrouge-0.1.3-py3.7.egg\pyrouge\Rouge155.py", line 368, in convert_and_evaluate
    rouge_output = self.evaluate(system_id, rouge_args)

  File "C:\Users\admin\Anaconda3\lib\site-packages\pyrouge-0.1.3-py3.7.egg\pyrouge\Rouge155.py", line 343, in evaluate
    rouge_output = check_output(command, env=env).decode("UTF-8")

  File "C:\Users\admin\Anaconda3\lib\subprocess.py", line 395, in check_output
    **kwargs).stdout

  File "C:\Users\admin\Anaconda3\lib\subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:

  File "C:\Users\admin\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 143, in __init__
    super(SubprocessPopen, self).__init__(*args, **kwargs)

  File "C:\Users\admin\Anaconda3\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)

  File "C:\Users\admin\Anaconda3\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)

FileNotFoundError: [WinError 2] The system cannot find the file specified 

Edit: Today, I ran the same code again, weirdly the error changed to CalledProcessError. Which is the same error written here. Here is the output:

2019-06-19 16:00:15,115 [MainThread  ] [INFO ]  Writing summaries.
... The same as the first one...
2019-06-19 16:00:15,129 [MainThread  ] [INFO ]  Running ROUGE with command perl  D:\study\ROUGE-1.5.5\ROUGE-1.5.5.pl -e D:\study\ROUGE-1.5.5\data -c 95 -2 -1 -U -r 1000 -n 4 -w 1.2 -a -m C:\Users\admin\AppData\Local\Temp\tmpgyd8zauc\rouge_conf.xml
Traceback (most recent call last):

  File "<ipython-input-2-732ec1e402fb>", line 1, in <module>
    runfile('C:/Users/admin/Desktop/somefolder/untitled0.py', wdir='C:/Users/admin/Desktop/somefolder')

  File "C:\Users\admin\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Users\admin\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/admin/Desktop/somefolder/untitled0.py", line 16, in <module>
    output = r.convert_and_evaluate()

  File "C:\Users\admin\Anaconda3\lib\site-packages\pyrouge-0.1.3-py3.7.egg\pyrouge\Rouge155.py", line 368, in convert_and_evaluate
    rouge_output = self.evaluate(system_id, rouge_args)

  File "C:\Users\admin\Anaconda3\lib\site-packages\pyrouge-0.1.3-py3.7.egg\pyrouge\Rouge155.py", line 343, in evaluate
    rouge_output = check_output(command, env=env).decode("UTF-8")

  File "C:\Users\admin\Anaconda3\lib\subprocess.py", line 395, in check_output
    **kwargs).stdout

  File "C:\Users\admin\Anaconda3\lib\subprocess.py", line 487, in run
    output=stdout, stderr=stderr)

CalledProcessError: Command '['perl ', 'D:\\study\\ROUGE-1.5.5\\ROUGE-1.5.5.pl', '-e', 'D:\\study\\ROUGE-1.5.5\\data', '-c', '95', '-2', '-1', '-U', '-r', '1000', '-n', '4', '-w', '1.2', '-a', '-m', 'C:\\Users\\admin\\AppData\\Local\\Temp\\tmpgyd8zauc\\rouge_conf.xml']' returned non-zero exit status 255.
mulaixi
  • 183
  • 2
  • 11

1 Answers1

0

I had a similar issue. The first error is caused if the path is not set properly.

D:\study\ROUGE-1.5.5\ROUGE-1.5.5.pl -e D:\study\ROUGE-1.5.5\data -c 95 -2 -1 -U -r 1000 -n 4 -w 1.2 -a -m C:\Users\admin\AppData\Local\Temp\tmpirzhwufa\rouge_conf.xml

Make sure the rouge paths are added in the environment variables and the cmd/terminal recognizes the path.

The second error may be due to some error in formatting of the decoded/reference sentences. The sentences must be in separate lines. You can check the processed output in the saved temp directory. It must be of the following structure:

<html>
<head>
<title>dummy title</title>
</head>
<body bgcolor="white">
<a name="1">[1]</a> <a href="#1" id=1>sentence 1</a>
<a name="2">[2]</a> <a href="#2" id=2>sentence 2</a>
</body>
</html>
sk_462
  • 587
  • 1
  • 7
  • 16
  • Thanks for your answer, I have tried what you said but It didn't make any difference. And also it can read the plain text files, and it has its own script to convert them to the ROUGE format. But what I did was realizing it was about Perl installation, I did all the steps related to Perl again, now seems like working. [by the help of this](https://github.com/bheinzerling/pyrouge/issues/9) – mulaixi Sep 05 '19 at 11:49