def compute_cer(str_pred, str_true, normalize=True):
"""Compute Character Error Rate.
Args:
str_pred (string): a sentence without spaces
str_true (string): a sentence without spaces
normalize (bool, optional): if True, divide by the length of str_true
Returns:
cer (float): Character Error Rate between str_true and str_pred
"""
cer = lev.distance(str_pred, str_true)
if normalize:
cer /= len(list(str_true))
return cer
edit_distance.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录