good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Re: Finding dictionary words in a string.by TilRMan (Friar) |
on Mar 13, 2004 at 07:28 UTC ( [id://336341]=note: print w/replies, xml ) | Need Help?? |
Okay, then, how fast is a not-so-naive solution for you? It's still not a real algorithm for finding likely English words, though. (Seems like there should be one out there, but I've never seen it.) So I improvise. This one generates a list of letter triples from the word list and finds those first. That speeds things up considerably. One thing that is bothering me is that you said you need to score each string by how well the words fit together. That sounds like a hairy problem if there are lots of ways to divide a string into words, each with different leftover garbage letters, different word lengths, etc. Whatever method you use to find the words will probably need to know something about how you score the strings so that it can look for the best fit.
--
In Section
Seekers of Perl Wisdom
|
|