in reply to Dict - Compare
Where did you get your dict.gz file from? Start adding print statements throughout the code (see Basic debugging checklist).$ cp /usr/share/dict/words ./dict $ gzip dict $ cat ./file.txt big dog bgfdsrt $ dict-compare -dictionary ./file.txt big : 1 dog : 1 $ dict-compare -glossary ./file.txt bgfdsrt : 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dict - Compare
by drno (Initiate) on Mar 29, 2010 at 16:41 UTC | |
Thanks toolic. I just gzipped a text file in the one word-per-line format stated in the comments at the bottom of the text: =head1 DICTIONARY FORMAT The dictionary is a one-word-per-line file that has been gzipped. Your dictionary can be anything. Think of the possibilities. It seems like dict-compare is only recognizing the last word in the dictionary (with the -dictionary prompt). Is there something else I should be doing concerning the dict.gz file? | [reply] |
by toolic (Bishop) on Mar 29, 2010 at 16:52 UTC | |
Another suggestion is to create a trivial dict file yourself with just 3 words in it:
Then, run the exact commands that I showed. You should get the output I posted. | [reply] [d/l] |
by drno (Initiate) on Mar 29, 2010 at 17:41 UTC | |
I used the three word dictionary as you suggested. Dict-compare is only recognizing the last entry in the dictionary. dict.gz = cat big dog file.txt = fish bird big lizard mammal "big" is recognized with -dictionary only when it is listed last. I've used print statements in the dictionary (sub readdict) to confirm that it is being read correctly as well as in the glossary (sub findwords). I'm pasting dict.gz and file.txt into my perl directory. Dict.gz is just a one-word-per line text file that is gzipped in gzip's directory and pasted into the perl directory. Thanks again. If you have a tip on where I should try to debug I'll definitely try it.
| [reply] [d/l] |