【发布时间】:2022-11-25 00:05:09
【问题描述】:
假设我们有 2 个单词序列
sentence1 = 'Ram is eating'
sentence2 = 'is Ram eating'
如何获得这样的 2 个序列的匹配百分比。
difflib sequenceMatcher 逐个字母匹配。在这些情况下找到匹配百分比的任何方法。
like match % in above case should be 100% as each word of 2 sentences 是平等的。
如果sentence2 = 'is Ram'
那么 sentence1 和 sentence 2 之间的 match% 将是 2/3 = 66.66%
match% = (number of words matching in sentence1 and sentence2 irrespective of position/total number of words in sentence1)*100
【问题讨论】:
-
请定义匹配百分比,它是什么?
-
@svfat 我已经用示例进行了编辑,希望能清除匹配%
标签: python nlp sequence sentence difflib