ebm@ibmarc.uucp (Eli Messinger) (04/22/89)
I'd like a C routine that takes a word list such as the standard /usr/dict/words and performs word look-up, much as 'spell' does, but only one word at a time. It should do all the necessary munging to get plurals and other pre- and suffixes. Ideally there should be a single function call isword(s), which returns true or false, depending on if the string s is a word. I've had little luck trying to extract this function from 'spell' itself, but if anyone has a suggestion as to how, that would also be appreciated. -- CSNET: ebm@ibm.com / UUCP: ...!uunet!ibmarc!ebm / VNET: ebm@almaden
tim@scsmo1.UUCP (04/24/89)
You can use /usr/lib/spell/spellprog to check words against the dictionary. Open 2 pipes, one to the process, one from the process, fork, then execl to spellprog. I sent a program to do just this to comp.srcs.unix but have not heard from rsalz so... If you want it, I will send it. The spell program is flakey, I would not use it. The dictionary hashing is too small so it misses lots of words. It was written to make use of a 20K word dictionary on disk with no large memory use. This machine will give me 8M of virtual, so that is no longer a concern but spell is still there. It sort the words, mine does not. I have yet to find a document that spell is faster on. My will also give more wrong words, as it will not check agains a local file and it things any numbers are wrong. I was considering using the hyphenation method from TeX to generate a hash value and use it in a very sparce matrix of all the words. tim@scsmo1.uucp