compare_transcripts.py 文件源码

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

项目:speech-to-text 作者: pluteski 项目源码 文件源码
def ratcliff_obershelp_similarity(a, b):
    """
    A kind of approximate string matching.
    Computes the generalized Ratcliff/Obershelp similarity of two strings
    as the number of matching characters divided by the total number of characters in the two strings.
    Matching characters are those in the longest common subsequence plus,
    recursively matching characters in the unmatched region on either side of the longest common subsequence.
    """
    if a and b:
        return SequenceMatcher(None, a, b).ratio()
    else:
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号