I've got to wonder why you want this?

I normally try to resist asking this question, because I personally dislike having to explain my reasoning to others... but.

There are so many different possibilities for each pair of strings, to want any given one seems nonsensical.

For example: Given the length (in words) of any two strings, you can generate an "edit transcript" thus:

my $shorter = min( $lenString1, $lenString2 ); my $longer = max( $lenString1, $lenString2 ); ## longer to shorter my $et = 'DI' x $shorter . 'D' x ( $longer - $shorter ); ## or shorter to longer my $et = 'DI' x $shorter . 'I' x ( $longer - $shorter );

Or:

## longer to shorter my $et = 'D' x $longer . 'I' x $shorter; ## shorter to longer my $et = 'D' x $shorter . 'I' x $longer;

As best I can tell, the only actually useful information you might glean from this, (done the full, laborious Levenstein way), is where the two sentences happen to contain the same word in the same position.

But given that if you had two identical sentences with the exception that one of the had an extra word at the start, eg:

'the quick brown fox' 'before the quick brown fox'

The Levenstein algorithm would fail to detect any 'same word in same place' and produce a "edit transcript" of (something like) 'DIDIDIDII'; I'm failing to see a good use?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Levenstein distance transcription by BrowserUk
in thread Levenstein distance transcription by Anonymous Monk

Title:
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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.