Consistency check fails when one of the files has no corrections to be made
In step 7 of the consistency checks, we usejsonNotes2ReannotationWebpage.py
to automatically apply the consistency corrections from the .json file on the initial corpus. But if .json contains no corrections for one of the files on input, the whole script crashes.
Sample call:
../utilities/lang-leaders/post-annot/jsonNotes2ReannotationWebpage.py --json-input ParsemeNotes.json --corpus-input NKJP.cupt PDB.cupt PCC.cupt pl-pdb-ud-dev-110-200-320.cupt pl-pdb-ud-dev-NEWS.cupt pl-pdb-ud-test-110-200-320.cupt pl-pdb-ud-test-NEWS.cupt pl-pdb-ud-test-OTHER.cupt pl-pdb-ud-train-110-200-320.cupt pl-pdb-ud-train-NEWS.cupt pl-pdb-ud-train-OTHER.cupt --generate-corpus > webpage3.html
Here ParsemeNotes.json
contains no corrections for file pl-pdb-ud-dev-OTHER.cupt
, and we get:
INFO: Saving to "./AfterAutoUpdate/NKJP.cupt"
INFO: Saving to "./AfterAutoUpdate/PCC.cupt"
INFO: Saving to "./AfterAutoUpdate/PDB.cupt"
INFO: Saving to "./AfterAutoUpdate/pl-pdb-ud-dev-110-200-320.cupt"
INFO: Saving to "./AfterAutoUpdate/pl-pdb-ud-dev-NEWS.cupt"
INFO: Saving to "./AfterAutoUpdate/pl-pdb-ud-dev-OTHER.cupt"
Traceback (most recent call last):
File "../utilities/lang-leaders/post-annot/jsonNotes2ReannotationWebpage.py", line 490, in <module>
Main(parser.parse_args()).run()
File "../utilities/lang-leaders/post-annot/jsonNotes2ReannotationWebpage.py", line 108, in run
sentences = [x[1] for x in sorted(fname2id2sent[fname].items())]
**KeyError: 'pl-pdb-ud-dev-OTHER.cupt'**
When --corpus-input
is followed only by the files mentioned in ParsemeNotes.json, the script runs fine.