مهدی هادیان2
دوشنبه 06 شهریور 1396, 14:09 عصر
بسم الله الرحمن الرحیم
با سلام
قطعه کد زیر موجود است:
from pythonrouge.pythonrouge import Pythonrouge
ROUGE_path = 'D://MySoftWare/UniversitySoftWare/Term4/TS/Evaluate/pythonrouge-master/pythonrouge-master/pythonrouge/RELEASE-1.5.5/ROUGE-1.5.5.pl' #ROUGE-1.5.5.pl
data_path = 'D://MySoftWare/UniversitySoftWare/Term4/TS/Evaluate/pythonrouge-master/pythonrouge-master/pythonrouge/RELEASE-1.5.5/data' #data folder in RELEASE-1.5.5
# initialize setting of ROUGE, eval ROUGE-1, 2, SU4, L
rouge = Pythonrouge(n_gram=2, ROUGE_SU4=True, ROUGE_L=True, stemming=True, stopwords=True, word_level=True, length_limit=True, length=50, use_cf=False, cf=95, scoring_formula="average", resampling=True, samples=1000, favor=True, p=0.5)
# system summary & reference summary
summary = [[" Tokyo is the one of the biggest city in the world."]]
reference = [[["The capital of Japan, Tokyo, is the center of Japanese economy."]]]
# If you evaluate ROUGE by sentence list as above, set files=False
setting_file = rouge.setting(files=False, summary=summary, reference=reference)
# If you need only recall of ROUGE metrics, set recall_only=True
result = rouge.eval_rouge(setting_file, recall_only=True, ROUGE_path=ROUGE_path, data_path=data_path)
print(result)
خطای زیر را میدهد:
Traceback (most recent call last): File "D:\MySoftWare\UniversitySoftWare\Term4\MyProjectPy thon\RougeSample.py", line 17, in <module>
result = rouge.eval_rouge(setting_file, recall_only=True, ROUGE_path=ROUGE_path, data_path=data_path)
File "C:\Python 3 6 2\lib\site-packages\pythonrouge-0.3-py3.6.egg\pythonrouge\pythonrouge.py", line 166, in eval_rouge
output = subprocess.check_output(rouge_cmd, stderr=subprocess.STDOUT)
File "C:\Python 3 6 2\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Python 3 6 2\lib\subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['perl', 'D:\\MySoftWare\\UniversitySoftWare\\Term4\\TS\\Ev aluate\\pythonrouge-master\\pythonrouge-master\\pythonrouge\\RELEASE-1.5.5\\ROUGE-1.5.5.pl', '-e', 'D:\\MySoftWare\\UniversitySoftWare\\Term4\\TS\\Ev aluate\\pythonrouge-master\\pythonrouge-master\\pythonrouge\\RELEASE-1.5.5\\data', '-a', '-n', '2', '-2', '4', '-u', '-l', '50', '-m', '-s', '-f', 'A', '-r', '1000', '-p', '0.5', 'C:\\Users\\Amin\\AppData\\Local\\Temp\\tmpc_9b_7l 5\\setting.xml']' returned non-zero exit status 2.
لازم به ذکر است که کد مذکور را روی ویندوز اجرا کردم.
با سپاس فراوان
با سلام
قطعه کد زیر موجود است:
from pythonrouge.pythonrouge import Pythonrouge
ROUGE_path = 'D://MySoftWare/UniversitySoftWare/Term4/TS/Evaluate/pythonrouge-master/pythonrouge-master/pythonrouge/RELEASE-1.5.5/ROUGE-1.5.5.pl' #ROUGE-1.5.5.pl
data_path = 'D://MySoftWare/UniversitySoftWare/Term4/TS/Evaluate/pythonrouge-master/pythonrouge-master/pythonrouge/RELEASE-1.5.5/data' #data folder in RELEASE-1.5.5
# initialize setting of ROUGE, eval ROUGE-1, 2, SU4, L
rouge = Pythonrouge(n_gram=2, ROUGE_SU4=True, ROUGE_L=True, stemming=True, stopwords=True, word_level=True, length_limit=True, length=50, use_cf=False, cf=95, scoring_formula="average", resampling=True, samples=1000, favor=True, p=0.5)
# system summary & reference summary
summary = [[" Tokyo is the one of the biggest city in the world."]]
reference = [[["The capital of Japan, Tokyo, is the center of Japanese economy."]]]
# If you evaluate ROUGE by sentence list as above, set files=False
setting_file = rouge.setting(files=False, summary=summary, reference=reference)
# If you need only recall of ROUGE metrics, set recall_only=True
result = rouge.eval_rouge(setting_file, recall_only=True, ROUGE_path=ROUGE_path, data_path=data_path)
print(result)
خطای زیر را میدهد:
Traceback (most recent call last): File "D:\MySoftWare\UniversitySoftWare\Term4\MyProjectPy thon\RougeSample.py", line 17, in <module>
result = rouge.eval_rouge(setting_file, recall_only=True, ROUGE_path=ROUGE_path, data_path=data_path)
File "C:\Python 3 6 2\lib\site-packages\pythonrouge-0.3-py3.6.egg\pythonrouge\pythonrouge.py", line 166, in eval_rouge
output = subprocess.check_output(rouge_cmd, stderr=subprocess.STDOUT)
File "C:\Python 3 6 2\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "C:\Python 3 6 2\lib\subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['perl', 'D:\\MySoftWare\\UniversitySoftWare\\Term4\\TS\\Ev aluate\\pythonrouge-master\\pythonrouge-master\\pythonrouge\\RELEASE-1.5.5\\ROUGE-1.5.5.pl', '-e', 'D:\\MySoftWare\\UniversitySoftWare\\Term4\\TS\\Ev aluate\\pythonrouge-master\\pythonrouge-master\\pythonrouge\\RELEASE-1.5.5\\data', '-a', '-n', '2', '-2', '4', '-u', '-l', '50', '-m', '-s', '-f', 'A', '-r', '1000', '-p', '0.5', 'C:\\Users\\Amin\\AppData\\Local\\Temp\\tmpc_9b_7l 5\\setting.xml']' returned non-zero exit status 2.
لازم به ذکر است که کد مذکور را روی ویندوز اجرا کردم.
با سپاس فراوان