Giter Club home page Giter Club logo

Comments (12)

PoppyLihhhh avatar PoppyLihhhh commented on May 20, 2024

same problem

from pythonrouge.

PoppyLihhhh avatar PoppyLihhhh commented on May 20, 2024

Have you resolve this issue??

from pythonrouge.

Yogayu avatar Yogayu commented on May 20, 2024

The Path is wrong.
You can use the example in the README.

Notice that the ROUGE_path and the data_path should be your local path.

For example:

from pythonrouge.pythonrouge import Pythonrouge
#ROUGE-1.5.5.pl
ROUGE_path = "/Users/apple/scrapingEnv/pythonrouge/pythonrouge/RELEASE-1.5.5/ROUGE-1.5.5.pl"
#data folder in RELEASE-1.5.5
data_path = "/Users/apple/scrapingEnv/pythonrouge/pythonrouge/RELEASE-1.5.5/data"
# 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."]]]
summary = [["Great location, very good selection of food for breakfast buffet.",
            "Stunning food, amazing service.",
            "The food is excellent and the service great."],
            ["The keyboard, more than 90% standard size, is just large enough .",
            "Surprisingly readable screen for the size .",
            "Smaller size videos   play even smoother ."]]
reference = [[["Food was excellent with a wide range of choices and good services.", "It was a bit expensive though."],
           ["Food can be a little bit overpriced, but is good for a hotel."],
           ["The food in the hotel was a little over priced but excellent in taste and choice.",
           "There were also many choices to eat in the near vicinity of the hotel."],
           ["The food is good, the service great.",
           "Very good selection of food for breakfast buffet."]
           ],
           [
           ["The size is great and allows for excellent portability.",
           "Makes it exceptionally easy to tote around, and the keyboard is fairly big considering the size of this netbook."],
           ["Size is small and manageable.",
           "Perfect size and weight.",
           "Great size for travel."],
           ["The keyboard is a decent size, a bit smaller then average but good.",
           "The laptop itself is small but big enough do do things on it."],
           ["In spite of being small it is still comfortable.",
           "The screen and keyboard are well sized for use"]
           ]
           ]
# 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=False, ROUGE_path=ROUGE_path, data_path=data_path)
print(result)

from pythonrouge.

 avatar commented on May 20, 2024

Hi @tagucci @Yogayu
I have set ROUGE_path and data_path properly already

ROUGE_path = r'C:\Downloads\ROUGE-1.5.5\ROUGE-1.5.5.pl'
data_path = r'C:\Downloads\ROUGE-1.5.5\data'

But I still got this error:

WindowsError                              Traceback (most recent call last)
<ipython-input-8-463accea89bc> in <module>()
     13 
     14 # If you need only recall of ROUGE metrics, set recall_only=True
---> 15 result = rouge.eval_rouge(setting_file, recall_only=True, ROUGE_path=ROUGE_path, data_path=data_path)
     16 print(result)

<ipython-input-5-f24a33cd5b51> in eval_rouge(self, xml_path, recall_only, f_measure_only, ROUGE_path, data_path)
    164         rouge_cmd.append(xml_path)
    165         print(rouge_cmd)
--> 166         output  = subprocess.check_output(rouge_cmd, stderr=subprocess.STDOUT)
    167         output  = output.decode("utf-8")
    168         outputs = output.strip().split("\n")

C:\Anaconda\lib\subprocess.pyc in check_output(*popenargs, **kwargs)
    565     if 'stdout' in kwargs:
    566         raise ValueError('stdout argument not allowed, it will be overridden.')
--> 567     process = Popen(stdout=PIPE, *popenargs, **kwargs)
    568     output, unused_err = process.communicate()
    569     retcode = process.poll()

C:\Anaconda\lib\subprocess.pyc in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
    709                                 p2cread, p2cwrite,
    710                                 c2pread, c2pwrite,
--> 711                                 errread, errwrite)
    712         except Exception:
    713             # Preserve original exception in case os.close raises.

C:\Anaconda\lib\subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, to_close, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)
    957                                          env,
    958                                          cwd,
--> 959                                          startupinfo)
    960             except pywintypes.error, e:
    961                 # Translate pywintypes.error to WindowsError, which is

WindowsError: [Error 2] The system cannot find the file specified

Could you please help me with this issue? Thanks!

from pythonrouge.

 avatar commented on May 20, 2024

When I tried it on centos, it returns this error:

subprocess.CalledProcessError: Command '['perl', '/home/gg/pythonrouge-master/pythonrouge/RELEASE-1.5.5/ROUGE-1.5.5.pl', '-e', '/home/gg/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', '/tmp/tmppT3n_b/setting.xml']' returned non-zero exit status 2

from pythonrouge.

rpanchal1996 avatar rpanchal1996 commented on May 20, 2024

I had the same issue. Turns out I was missing a few perl based dependencies. You should just try running the ROUGE-1.5.5.pl script in your terminal by doing perl ROUGE-1.5.5.pl. Check for the errors, if any you may get and resolve the missing dependencies individually. I had a missing XML::Parser package. Installing it solved the problem.

from pythonrouge.

MahdiDoost avatar MahdiDoost commented on May 20, 2024

In the name of God

hello

I run example in windows 7.
`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

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)

summary = [[" Tokyo is the one of the biggest city in the world."]]
reference = [[["The capital of Japan, Tokyo, is the center of Japanese economy."]]]

setting_file = rouge.setting(files=False, summary=summary, reference=reference)

result = rouge.eval_rouge(setting_file, recall_only=True, ROUGE_path=ROUGE_path, data_path=data_path)
print(result)`

And get followed Error:
Traceback (most recent call last): File "D:\MySoftWare\UniversitySoftWare\Term4\MyProjectPython\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\\Evaluate\\pythonrouge-master\\pythonrouge-master\\pythonrouge\\RELEASE-1.5.5\\ROUGE-1.5.5.pl', '-e', 'D:\\MySoftWare\\UniversitySoftWare\\Term4\\TS\\Evaluate\\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\\tmp71ki_b6z\\setting.xml']' returned non-zero exit status 2.

Do the library run in windows?
thank you

from pythonrouge.

rpanchal1996 avatar rpanchal1996 commented on May 20, 2024

Like I said, try to run the perl script from the command line directly, and not via the pythonrouge package. You will come to know if you have any perl related issues (missing dependencies, path etc).

from pythonrouge.

MahdiDoost avatar MahdiDoost commented on May 20, 2024

In the name of God
hello
thank you for your answer

I do it and get followed Error:
Can 't locate DB_File.pm in @INC (you may need to install the DB_File module)

I install Active Perl 5.24 for install DB_File and I type ppm install DB_File in cmd of window 7.
Error is:
No missing packages to install.

Is there DB_File for windows?
Thank you

from pythonrouge.

MahdiDoost avatar MahdiDoost commented on May 20, 2024

In the name of God
Hi,
Is pythonrouge suitable for utf_8?
Thank you

from pythonrouge.

MahdiDoost avatar MahdiDoost commented on May 20, 2024

In the name of god
hello
I run sample and give me Error:

Traceback (most recent call last):
  File "/media/aliasghar/01CDBF1969EE87A0/MySoftWare/UniversitySoftWare/Term4/MyProjectPython/RougeSample.py", line 18, in <module>
    result = rouge.eval_rouge(setting_file, recall_only=True, ROUGE_path=ROUGE_path, data_path=data_path)
  File "/usr/local/lib/python3.5/dist-packages/pythonrouge/pythonrouge.py", line 166, in eval_rouge
    output  = subprocess.check_output(rouge_cmd, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.5/subprocess.py", line 398, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['perl', '/media/aliasghar/01CDBF1969EE87A0/MySoftWare/UniversitySoftWare/Term4/TS/Evaluate/pythonrouge-master/pythonrouge-master/pythonrouge/RELEASE-1.5.5/ROUGE-1.5.5.pl', '-e', '/media/aliasghar/01CDBF1969EE87A0/MySoftWare/UniversitySoftWare/Term4/TS/Evaluate/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', '/tmp/tmp3tdl6l2z/setting.xml']' returned non-zero exit status 255

Like I said, try to run the perl script from the command line directly, and not via the pythonrouge package. You will come to know if you have any perl related issues (missing dependencies, path etc).

I run ROUGE-1.5.5.pl in terminal in linux with typing perl ROUGE-1.5.5.pl and get followed text:

ROUGE-1.5.5.pl
         [-a (evaluate all systems)] 
         [-c cf]
         [-d (print per evaluation scores)] 
         [-e ROUGE_EVAL_HOME] 
         [-h (usage)] 
         [-H (detailed usage)] 
         [-b n-bytes|-l n-words] 
         [-m (use Porter stemmer)] 
         [-n max-ngram] 
         [-s (remove stopwords)] 
         [-r number-of-samples (for resampling)] 
         [-2 max-gap-length (if < 0 then no gap length limit)] 
         [-3 <H|HM|HMR|HM1|HMR1|HMR2> (for scoring based on BE)] 
         [-u (include unigram in skip-bigram) default no)] 
         [-U (same as -u but also compute regular skip-bigram)] 
         [-w weight (weighting factor for WLCS)] 
         [-v (verbose)] 
         [-x (do not calculate ROUGE-L)] 
         [-f A|B (scoring formula)] 
         [-p alpha (0 <= alpha <=1)] 
         [-t 0|1|2 (count by token instead of sentence)] 
         [-z <SEE|SPL|ISI|SIMPLE>] 
         <ROUGE-eval-config-file> [<systemID>]

thank you

from pythonrouge.

MahdiDoost avatar MahdiDoost commented on May 20, 2024

In The name of GOD
hello,
I do two tasks:

  1. I install XML::DOM with typing cpan XML::DOM in terminal.
    Then I run rouge 1.5.5 and I get following Error:
    Cannot open exception db file for reading: /home/pythonrouge/pythonrouge/RELEASE-1.5.5/data/WordNet-2.0.exc.db
    I create a new WordNet-2.0.exc.db by running the buildExceptionDB.pl script in the "data/WordNet-2.0-Exceptions" subdirectory.

2.I use from "https://libraries.io/github/tagucci/pythonrouge"

cd pythonrouge/RELEASE-1.5.5/data/
rm WordNet-2.0.exc.db
./WordNet-2.0-Exceptions/buildExeptionDB.pl ./WordNet-2.0-Exceptions ./smart_common_words.txt ./WordNet-2.0.exc.db

from pythonrouge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.