word_error_rate()

audmetric.word_error_rate(truth, prediction)[source]

Word error rate based on edit distance.

Parameters
  • truth (Sequence[Sequence[str]]) – ground truth strings

  • prediction (Sequence[Sequence[str]]) – predicted strings

Return type

float

Returns

word error rate

Raises

ValueError – if truth and prediction differ in length

Examples

>>> truth = [["lorem", "ipsum"], ["north", "wind", "and", "sun"]]
>>> prediction = [["lorm", "ipsum"], ["north", "wind"]]
>>> word_error_rate(truth, prediction)
0.5