Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Search for identical substrings

by BrowserUk (Patriarch)
on Aug 19, 2005 at 00:54 UTC ( [id://484995]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Search for identical substrings
in thread Search for identical substrings

The problem is that the "LCS" in Algorithm::Diff is Longest Common Sub-Sequence, but for your requirements you need Longest Common String.

The difference being the latter is contiguous, whilst the former is not (need not be).

You're after this?

P:\test>lcs "banana is split" "banana..s split" banana is split banana..s split s split

I'm still verifying my algorithm is correct, but so far it appears to be about 10x quicker than the XS version of LCSS despite being pure perl.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

Replies are listed 'Best First'.
Re^4: Search for identical substrings
by bioMan (Beadle) on Aug 19, 2005 at 16:50 UTC

    You are correct I want the string "s split". Per GrandFather's request I'll try to put some real data into my scratchpad later today.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-19 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found