Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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.
Example:
(excuse me for not actually checking against a dictionary for obsucure words)
w>h>e>r>e>r
r=dead end
"where" removed
a>n>g>e>l>s>a
a=dead end
"angels" removed
a>r>e>a>l
l = dead end
"area" removed
l>l>t>h
not making sense, backup
a>r>e>|
stop at "a"
"are" removed
a>l>l>t
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://209639]
help
Chatterbox?
[virtualsue]: Lotus biscuits
[Discipulus]: mornign nuns and monks!
[1nickt]: Woah you can get Krispy Kreme doughnut-Lotus Biscoff hybrids!
[1nickt]: Biscuit technology has evolved since I left the UK, obviously.
[virtualsue]: we have a jar of the spread: https://www. sainsburys.co.uk/ webapp/wcs/stores/ servlet/gb/ groceries/lotus- caram-spread- smooth-400g?langId =44&storeId=10151& krypto=VEjeoyIieB6 2oiiKUSbS %2Foxs9BpfJxZ95MW6 y6NOiYDYlKgl6SghbS BZf7CU5b6QA00pmYz7 XmfTYYKpoIiUivBBOR y6MI
[virtualsue]: yuk url https://www.amazon .co.uk/Lotus- Original- Caramelised-Spread -Smooth/dp/ B002LA793I

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-11-20 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (286 votes). Check out past polls.

    Notices?