ghpaetzold / questplusplus

Pipelined quality estimation.
49 stars 14 forks source link

Fix crash on missing output dir #46

Open zouharvi opened 5 years ago

zouharvi commented 5 years ago

When freshly cloning the project, the output/test/output.txt file is not present, nor the parent folders. When running the basic usage command the program crashes as the folders are not created (however creates them in the process). After crashing several times, output/test/output.txt is finally created and the program works.

java -cp QuEst++.jar:lib/* shef.mt.WordLevelFeatureExtractor -lang english spanish -input input/source.word-level.en input/target.word-level.es -alignments lang_resources/alignments/alignments.word-level.out -config config/config.word-level.properties

This is not an issue for already existing installations, as they already contain the output file dir structure, but for better out-of-the-box experience this should be fixed. This pull request adds code that properly handles output file initialization.

This bug appears on Linux (Fedora 30) with Java 1.8.0. Not tested on Windows nor OS/X. Tested on WordLevel, but it's identical on SentenceLevel and DocumentLevel.

Since this commit changes the Java source files, the executable should be updated as well. The last update to QuEst++.jar was 4 years ago, when GitHub didn't have the max 100 MB files policy. I tried adding QuEst++.jar to LFS (standard procedure), but alas I'm not allowed to add new LFS files to public forks. If this pull request is accepted, please follow up with a commit, which updates QuEst++.jar so that it matches the source files.