swabhs/open-sesame

Missing sentences

gossminn opened this issue · 0 comments

Currently, if no targets are found for a particular input sentence, no output at all will be produced for this sentence. This causes problems if you are trying to get frame annotations for some raw input, and then try to map these frame annotations back to the corresponding sentences in the input, since the number of input sentences and output sentences won't match.

The relevant code is:

def print_as_conll(gold_examples, predicted_target_dict):
"""
Creates a CoNLL object with predicted target and lexical unit.
Spits out one CoNLL for each LU.
"""
with codecs.open(out_conll_file, "w", "utf-8") as conll_file:
for gold, pred in zip(gold_examples, predicted_target_dict):
for target in sorted(pred):
result = gold.get_predicted_target_conll(target, pred[target][0]) + "\n"
conll_file.write(result)
conll_file.close()

If pred is empty for a particular instance, nothing will be written.

Would it be possible to (optionally, to not break the CONLL format) write some kind of null output (e.g. "SKIPPED_SENTENCE"), so that, when processing the output, it's easier to find which sentences are missing?