列表比较

发布于 2024-08-24 11:59:37 字数 158 浏览 2 评论 0原文

我想计算两个列表之间的相似度百分比作为示例,如果我有两个描述图书属性的列表 list1(作者、品牌、isbn、类别、数量) list2(作者、价格、品牌) 我看到这个函数相似度= n/m,其中n是匹配概念的数量,m是两个列表中较小的基数我不知道它是否正确我看到m必须是具有更多概念的列表你同意我吗??

i want to calculate the percent of similarity between two lists as an example if i have two list that describe book attribute list1(author, brand , isbn, category, amount) list2(author , price , brand)
i saw this function similarity= n/m where n is the number of matched concepts and m is the smaller cardinality of two lists i dont know if it is correct i see that m must be the list with more number of concepts do you agree me??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

_蜘蛛 2024-08-31 11:59:37

Python 标准库有一个名为 difflib.SequenceMatcher 的类,它可以计算任意两个列表的相似度。

The Python standard library has a class called difflib.SequenceMatcher that can compute this degree of similarity for any two lists.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文