|
|
|
@ -2,7 +2,7 @@ from __future__ import division, print_function
|
|
|
|
|
|
|
|
|
|
import math
|
|
|
|
|
|
|
|
|
|
from .. import word_error_rate, words, unordered_word_error_rate
|
|
|
|
|
from .. import word_error_rate, words
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_words():
|
|
|
|
@ -35,11 +35,3 @@ def test_word_error_rate():
|
|
|
|
|
assert word_error_rate('', '') == 0
|
|
|
|
|
|
|
|
|
|
assert word_error_rate('Schlyñ lorem ipsum dolor sit amet,', 'Schlym̃ lorem ipsum dolor sit amet.') == 1/6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_unordered_word_error_rate():
|
|
|
|
|
assert unordered_word_error_rate('abc def ghi', 'ghi abc def') == 0
|
|
|
|
|
assert unordered_word_error_rate('abc def ghi', 'ghi abcX def') == 1/3
|
|
|
|
|
assert unordered_word_error_rate('abc def ghi jkl', 'abc ghi def jkl') == 0
|
|
|
|
|
assert unordered_word_error_rate('abc def ghi jkl', 'abc ghi defX jkl') == 1/4
|
|
|
|
|
# XXX There seem to be some cases where this does not work
|
|
|
|
|