Skip to content
Snippets Groups Projects
Commit ada1cdb1 authored by Franck Dary's avatar Franck Dary
Browse files

Added colnames in eval script for error comparison

parent d9968e9f
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment