edit_distance.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:tensorflow_end2end_speech_recognition 作者: hirofumi0810 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号