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

Re: Junk NOT words

by Anonymous Monk
on Nov 01, 2002 at 04:58 UTC ( #209639=note: print w/replies, xml ) Need Help??

in reply to Junk NOT words

How about you index the dictionary file and then work you're way through the string character by character matching against the word. When the next letter results in no further branches in the index it takes that as a word, if the next word results in a dead end try the previous word again minus one character.
(excuse me for not actually checking against a dictionary for obsucure words)
r=dead end
"where" removed
a=dead end
"angels" removed
l = dead end
"area" removed
not making sense, backup
stop at "a"
"are" removed
t=dead end
"all" removed
ugh... hope you get the idea.

Replies are listed 'Best First'.
Re: Re: Junk NOT words
by Anonymous Monk on Nov 01, 2002 at 16:26 UTC
    The problem with this algorithm, is that it has a VERY bad worse case performance, it's in O(2^n), where n is the length of the string. Meaning that as the strings get larger, this problem will become insolvable by deterministic methods. Some sort of heuristic is needed.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://209639]
[LanX]: machiato!
shmem fills a glas with sambuca, drops 3 beans of coffee into it, lights the stuff and hands it to erix
[Your Mother]: Liquore Strega. :P
[shmem]: s/beans of coffee/enterprise beans/ :-P
[erix]: Take your bottles -- you're all invited! :)
[panwarsagar]: I have started learning Perl and my moto is to process a text file and storing the contents in a Data Base

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2017-03-28 12:22 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (330 votes). Check out past polls.