brent@poseidon.UUCP (Brent P. Callaghan) (01/16/86)
Hi netlanders, Here is YET ANOTHER spelling checker script. Why post yet another ? Because the spell(1) program *begs* for these things to be written. I like this one because it's non-verbose, very fast, and easy to use (of course). It drops you into your favorite editor so you can browse the list of "funny" words and fix any misspellings. If you change a word - it is fixed throughout your document, otherwise it's added to your local dictionary. I've been using it for a while. So far, it hasn't changed any words it shouldn't. Try it - you'll like it! Note: It needs the editor "ex(1)" even if you don't use it personally. Made in New Zealand --> Brent Callaghan AT&T Information Systems, Lincroft, NJ {ihnp4|mtuxo|pegasus}!poseidon!brent (201) 576-3475 ---- cut here ------ cut here ------ cut here ------ cut here ------ #!/bin/sh # This is a shar archive. # The rest of this file is a shell script which will extract: # manpage vspell # Archive created: Thu Jan 16 10:19:04 EST 1986 echo x - manpage sed 's/^X//' > manpage << '~FUNKY STUFF~' X.TH VSPELL 1 "" X.SH NAME vspell \- visual spelling corrector X.SH SYNOPSIS X.B vspell X.I document X.B [ X.I local dictionary X.B ] X.SH DESCRIPTION Invokes X.I spell(1) to find misspelled words in a document. Candidate misspellings are placed in a temporary file to be edited. The X.I vi(1) editor is used unless the environment variable EDITOR is set to the name of an alternative editor. The user may correct any misspelled words on the screen and exit the editor normally. X.P Words which have not been changed are assumed to be correctly spelled and are added to a local dictionary in the current directory. If there is no local dictionary then one is created. The name of the local dictionary may be given as an argument on the X.I vspell command line. If not given on the command line, the value of the environment variable DICT is used. If DICT is not set then the name defaults to "spelldict". X.P Words which have been changed in the editor are automatically corrected throughout the document. X.SH FILES /tmp/spell1$$ Output from spell X.br /tmp/spell2$$ Corrected output X.br /tmp/spell3$$ New words for the dictionary X.SH SEE ALSO spell(1) ~FUNKY STUFF~ ls -l manpage echo x - vspell sed 's/^X//' > vspell << '~FUNKY STUFF~' ###### Vspell ###### # # Uses spell(1) to check the spelling of your document. # If there are spelling mistakes, it invokes your # editor on the spell output. Misspelled words are # corrected and the editor exited normally. Changed # words are fixed automatically in the document. # Words not changed are added to a local dictionary. # # Brent Callaghan October 1985 if test $# = 0 -o $# -gt 2 ; then echo "Usage: $0 filename [ dictionary ]" exit 1 fi doc=$1 if test ! -r $doc ; then echo "Can't open $doc" exit 1 fi dict=${2-${DICT-spelldict}} f1=/tmp/spell1$$ f2=/tmp/spell2$$ f3=/tmp/spell3$$ trap "rm /tmp/spell[123]$$ ; exit" 0 1 2 3 if test -s "$dict" ; then spell +$dict $1 # use local dict else spell $1 # no local dict fi > $f1 if test ! -s $f1 ; then exit ; fi # exit if no misspellings cp $f1 $f2 ${EDITOR-vi} $f2 # edit comm -12 $f1 $f2 > $f3 if test -s $f3 ; then # remember new words sort -m -o$dict $dict $f3 set `wc -w $f3` echo "$1 words added to \"$dict\"" fi if cmp -s $f1 $f2 ; then exit ; fi # exit if no changes paste -d\| $f1 $f2 |\ awk -F\| \ '$1 != $2 {printf "1,$s/\\<%s\\>/%s/g\n", $1, $2}END{printf "w\nq\n"}' |\ ex - $doc # make corrections exit ~FUNKY STUFF~ chmod +x vspell ls -l vspell # The following exit is to ensure that extra garbage # after the end of the shar file will be ignored. exit 0