tags:

views:

34

answers:

1

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??

A: 

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

Eli Bendersky