home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d191 / ispell.lha / ISpell / unix.zoo / makedict.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1989-02-22  |  1KB  |  49 lines

  1. #!/bin/sh
  2. #
  3. #    Make a beginning dictionary file for ispell, using an existing
  4. #    speller.
  5. #
  6. #    Usage:
  7. #
  8. #    makedict file-list
  9. #
  10. #    The specified files are collected, split into words, and run through
  11. #    the system speller (usually spell(1)).  Any words that the speller
  12. #    accepts will be written to the standard output for use in making
  13. #    an ispell dictionary.  Usually, you will want to run the output
  14. #    of this script through "munchlist" to get a final dictionary.
  15. #
  16.  
  17. # This program must produce a list of INCORRECTLY spelled words on standard
  18. # output, given a list of words on standard input.  If you don't have a
  19. # speller, but do have a lot of correctly-spelled files, try /bin/true.
  20. #
  21.  
  22. # SPELLPROG="${SPELLPROG:-spell}"
  23. SPELLPROG=/usr/bin/spell
  24.  
  25. # TMP=${TMPDIR:-/tmp}/mkdict$$
  26. TMP=/tmp/mkdict$$
  27.  
  28. case "$#" in
  29.     0)
  30.     set X -
  31.     shift
  32.     ;;
  33. esac
  34.  
  35. trap "/bin/rm ${TMP}*; exit 1" 1 2 15
  36.  
  37. # cat "$@" | tr -cs "A-Za-z'" '\012' | sort -uf -o ${TMP}
  38. # $SPELLPROG < ${TMP} | comm -13 - ${TMP}
  39. # /bin/rm ${TMP}
  40.  
  41. # Use less processes at the expense of more temporary files.
  42.  
  43. cat "$@" | tr -cs "A-Za-z'" '\012' > ${TMP}a
  44. sort -uf -o ${TMP}b < ${TMP}a
  45. $SPELLPROG < ${TMP}b > ${TMP}c
  46. comm -13 ${TMP}c ${TMP}b
  47. /bin/rm ${TMP}*
  48.  
  49.