Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://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
abcdef
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.
Regards,
Roopa

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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-20 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found