zhijing-jin / bleu

A Handy Python wrapper for common NLP evaluation scripts like BLEU.
BSD 3-Clause "New" or "Revised" License
13 stars 2 forks source link

where to download the file "multi-bleu-detok.perl" #1

Closed jind11 closed 4 years ago

jind11 commented 4 years ago

hi, I tried to run your code but got the error of "no file named multi-bleu-detok.perl", could you refer to the link for downloading this file? Thanks!

zhijing-jin commented 4 years ago

There is an automatic download function in Line 147 of the code:

See bleu.py (Line 147).

def download_scripts():
    files = [('detokenizer.perl',
              'https://raw.githubusercontent.com/moses-smt/mosesdecoder/master/scripts/tokenizer/detokenizer.perl'),
             ('multi-bleu-detok.perl',
              'https://raw.githubusercontent.com/moses-smt/mosesdecoder/master/scripts/generic/multi-bleu-detok.perl'),
             ('multi-bleu.perl',
              'https://raw.githubusercontent.com/moses-smt/mosesdecoder/master/scripts/generic/multi-bleu.perl'),
             ]
    for fname, url in files:
        if not os.path.isfile(fname):
            os.system('curl -o {fname} {url}'.format(fname=fname, url=url))

Should you have any further questions, feel free to let me know.

jind11 commented 4 years ago

in line 96 of "bleu.py", you did not consider the case where there is suffix in the filename, which is actually very common when people are doing experiments. You need to consider this situation.

zhijing-jin commented 4 years ago

Let me change it in a future version. Thanks for the suggestion!

jind11 commented 4 years ago

function "download_scripts" is not automatically executed when there are no "multi-bleu-detok.perl" files, so readers will get confused and do not know where to find it.

zhijing-jin commented 4 years ago

This sounds very weird. I just cloned the package but no error shows up. Theoretically, download_scripts() will be executed if any of the files in ["detokenizer.perl", "multi-bleu-detok.perl", "multi-bleu.perl"] does not exist. (See Line156)