diff --git a/scripts/conll18_ud_eval.py b/scripts/conll18_ud_eval.py index 4ddf21122b6a92967a5cdde4845c4d99536f3333..8dd5ea89e0a23d232d1c79a1b42bcb9cd4426de7 100755 --- a/scripts/conll18_ud_eval.py +++ b/scripts/conll18_ud_eval.py @@ -109,6 +109,9 @@ index2col = {} metric2colname = { "UPOS" : "UPOS", "Lemmas" : "LEMMA", + "UFeats" : "FEATS", + "UAS" : "HEAD", + "LAS" : "DEPREL", } defaultColumns = { @@ -632,6 +635,9 @@ def evaluate_wrapper(args) : ################################################################################ class Error : def __init__(self, gold_file, system_file, gold_word, system_word, metric) : + if metric not in metric2colname : + raise(Exception("Metric '%s' don't have corresponding colname in '%s'"%(metric, metric2colname.keys()))) + self.gold = gold_word self.pred = system_word self.gold_sentence = gold_file.words[gold_file.sentences_words[self.gold.sentence].start:gold_file.sentences_words[self.gold.sentence].end] @@ -696,6 +702,8 @@ class ErrorType : ################################################################################ def compute_errors(gold_file, system_file, evaluation, metric) : errors = Errors(metric) + if metric not in evaluation : + raise(Exception("metric '%s' not in evaluation : '%s'"%(metric, evaluation.keys()))) for alignment_word in evaluation[metric][1] : gold = alignment_word.gold_word pred = alignment_word.system_word