开发者

list comparision

开发者 https://www.devze.com 2022-12-21 22:48 出处:网络
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) lis开发者_运维技巧t2(author

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) lis开发者_运维技巧t2(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??


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

0

精彩评论

暂无评论...
验证码 换一张
取 消