fix division by zero in normalized edit distance
This commit is contained in:
parent
f0b17556b8
commit
3953e51381
5
test.py
5
test.py
|
@ -126,7 +126,10 @@ def validation(model, criterion, evaluation_loader, converter, opt):
|
|||
|
||||
if pred == gt:
|
||||
n_correct += 1
|
||||
norm_ED += edit_distance(pred, gt) / len(gt)
|
||||
if len(gt) == 0:
|
||||
norm_ED += 1
|
||||
else:
|
||||
norm_ED += edit_distance(pred, gt) / len(gt)
|
||||
|
||||
accuracy = n_correct / float(length_of_data) * 100
|
||||
|
||||
|
|
Loading…
Reference in New Issue