tags:

views:

49

answers:

3
+3  Q: 

lists similarity

if i have to list of concepts and i want to find the similarity between 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)

+1  A: 

The easiest way is probably to calculate the edit distance between each of the elements of the list.

Ignacio Vazquez-Abrams
yes i will use edit distance to caculate the similarity betwwen concept names but also i want to calculate the percent of similarity between two lists 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??
aman
i wait for you responce
aman
A: 

You can use the Jaccard index to compare the similarity of two sets.

Nick D
A: 

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();
pavun_cool
how? please explain more
aman
I have given you the example perl code for your requirement. go through and get to know.
pavun_cool
thank you so much
aman