lists similarity
if i have to list of concepts and i want to find the similarity be开发者_如何学编程tween these list how can i find how much two list similar? as an example if i have two list that describe book attribute list1(author, brand , isbn, category, amount) list2(author , price , brand)
The easiest way is probably to calculate the edit distance between each of the elements of the list.
You can use the Jaccard index to compare the similarity of two sets.
Perl
Use this module , for comparing two lists elements. Compare # Compare elements of two or more lists
List::Compare ;
use Data::Dumper ;
use lib "specify the path ";
use List::Compare;
@Llist= ( 1,2,3,4,6) ;
@Rlist=(101,3,4,5,20,30) ;
$lc = List::Compare->new( \@Llist, \@Rlist);
print Dumper \$lc->get_intersection();
精彩评论