|
[Home] [Puzzles & Projects] [Delphi Techniques] [Math Topics] [Library] [Utilities] |
|
Problem DescriptionThis is the first installment of a series of program about words. I've included 2 programs here. The first, DicMaint, introduces the dictionary structure and provides code to maintain them. The second program, CrosswordHelper, is a word completion program, displays a list of dictionary words matching a mask of known letters Background & TechniquesThe first requirement for many word manipulation
problems is a dictionary. Not the the kind
with definitions, just the kind with a list of valid words. The TDic object
compresses a wordlist to about half of its uncompressed size. The wordlist is maintained as a
TStringList object. The initial letters of each word in the list are replaced by a byte with the count of letters which match the preceding
word. Unused bits of this byte also flag foreign words and abbreviations. CrosswordHelper addendum, Jan 20,2001: I added mask characters "?" as a synonym for "_", and "*" to represent any number of unknown characters. Works great to find rhyming words for you poets out there! Implementation was simplified when I ran across the MatchesMask function included in Delphi's Mask unit. I've put three dictionaries in a separate download file. Full.dic contains about 60,000 words. General.dic about 16,000 and Small.dic about 1500 words. All should be considered works in progress. Any errors for suggestions for improvements will be appreciated. Small.dic is duplicated with each of the source and object downloads, so that any download should be runnable, even though you'll want to use one of the larger dictionaries for most purposes. In general, I'd say that for checking words, you'll want to use the largest dictionary and for pprograms that generate words, you would be better served by one of the smaller dictionaries. Running/Exploring the Program
Suggestions for Further Explorations
|
[Feedback] [Newsletters (subscribe/view)] [About me]Copyright © 2000-2012, Gary Darby
All rights reserved.
|