Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Similarity matrix

by lima1 (Curate)
on Jan 31, 2008 at 16:53 UTC ( #665386=note: print w/replies, xml ) Need Help??

in reply to Similarity matrix

Maybe something like this? Assumes symmetry (d(x, y) = d(y, x)).
my @sim; my @words = ...; for my $i (0 .. $#words) { for my $j ( ($i+1) .. $#words) { $sim[$i][$j] = similarity( $words[$i], $words[$j]) $sim[$j][$i] = $sim[$i][$j]; } } sub similarity { my ( $w1, $w2 ) = @_; my $sim = 1; # calc simularity return sim; }

Replies are listed 'Best First'.
Re^2: Similarity matrix
by smilly (Novice) on Feb 01, 2008 at 23:07 UTC

    it's a good help friend, tx. just i have to more questions:
    1- how to read a corpus. (just normal open file can help me?)
    2- how to use a module with its parameters in my sub routines?(considering i want to use wordner::similarity module)
    tx alot for help.
Re^2: Similarity matrix
by Anonymous Monk on Feb 04, 2008 at 14:40 UTC
    Dear friend i could somehow figure it out but in $sim$j$i i get scalar found error saying: scalar found where operation expected... how can i figure it out?
      hey friends i fixed that:) just i dont know why i get readline() on closed filehandle FILE error... any idea?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://665386]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-04-18 09:50 GMT
Find Nodes?
    Voting Booth?

    No recent polls found