Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
hello, I am trying to compare string similarity based on the function sort_by_similarity().The strings are stored as array of hashes,I am unable to understand the way to get the sorted strings by similarity. I tried it in this way.
for($x=0;$x<$r;$x++){ @b = sort_by_similarity( \@querysubs,$inputsubs[$x]{'sequence'}); $y=\@b; #@array=@$y; #print $y->[0]; #$m=\@array; #print $m; $h=\($y->[0]); print $$h; #%hash=%\($y->[0]); foreach my $key(keys %hash){ #print "$key:$hash{$key}\n"; } }
Here $inputsubs$x{'sequence'} gives the input string and this is compared with the strings in @querysubs. Ex:-If the input string is
It gets divided into abc bcd cde def according to 3 as the windowsize. If the query sequence is abcefg It even gets divided into abc bce cef efg

I need to compare each of the strings in the inputsubs with the querysubs and get the best matching string for each of these strings using the function sort_by_similarity(),but I am unable to understand the value returned by the function and unable to access the values and print them.

Please help me in solving out this problem.

20091109 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

In reply to string similarity by using a function sort_by_similarity() by roopa

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (11)
    As of 2015-01-29 13:29 GMT
    Find Nodes?
      Voting Booth?

      My top resolution in 2015 is:

      Results (238 votes), past polls