WAITS: The first interactive spell checker

Today we'll look at SPELL, probably the world's first interactive spell checker, which debuted on WAITS in 1971.

/images/waits/waits-spell.png The WAITS spell checker on the III. Source: Rupert Lane. License: CC0.

Origins

The origins of SPELL are in work Les Earnest did at MIT to recognise cursive handwriting in the late 1960s/early 1960s. He put together a dictionary of around 10,000 English words (from ABANDON to ZOOLOGICAL) and wrote a subroutine in assembly to match against handwritten words, producing an output file of words not recognised. Les moved to SAIL in 1965 and took his dictionary with him (pictured below, on paper tape). In 1967 this was used by a grad student to write a program in LISP that would match words in a text file and print out anything it did not recognise.

/images/waits/words-on-paper-tape.png 10,000 words on paper tape. Source: Les Earnest via archive.org. License: CC BY-NC-ND 3.0

Finally, in 1971. Ralph Gorin (the REG whose login we have been using to access our emulated WAITS instance) wrote SPELL, using the same dictionary. This took a text file - and an optional user dictionary - as input, checked the words contained and if it did not recognise a word, offer the user several alternatives such as select a candidate replacement from the dictionary, ignore the word, add to personal dictionary etc. This became popular at SAIL and was also adopted by Tenex and other PDP-10 sites. Later versions could understand text files using document preparation languages like PUB and TeX.

Running SPELL

Type R SPELL to start the program. On display terminals it will present a multi-pane-of-glass view like the above, but it also supports an interactive teletype session with * as the prompt.

First it asks if you want a personal directory and any switches to support dictionary maintenance. It will then ask for the input and output files (it can't edit a file in place). Here we'll use a file called blog.in that contains a single sentence "I make mnay mistakes.".

.r spell
Do you want to augment the dictionary? n
Mode switches (zero or more of T,Q,N,U,P,A, or ?):  
Name of the file to check and correct: blog.in
File name for correction output: blog.out
File for exceptions: 
No exception file.

When it detects a spelling mistake it will prompt you for what to do next

working...
Page 1:1
I make mnay mistakes.
mnay
Type S,A,I,R,X,D,W,L or ?

If you've ever run ispell on Unix (or its Emacs interface) the commands will look remarkably similar - a to accept, i to insert into personal directory, r to retype the word by hand etc. In fact ispell traces its origins back to SPELL, starting with a revised version on the PDP-10 and eventually being ported to C and Unix.

On the display terminal you can see a list of candidate words on the right which you can choose from. On teletypes, you need to press s and then use Return to see the options.

*s
Type C,^,<altmode>,<cr> or ?
MANY
*
MAY
*
Those are all the choices.  Type S,A,I,R,X,D,W,L or ?
*s
Type C,^,<altmode>,<cr> or ?
MANY
*c
Finished.

Before it exits it will prompt for some options to continue checking other files or manage core files. But the normal response is e to save the output file and exit.

Type E,S,C,A,D,I, or ? e

EXIT
^C

Source code

The 1974 source code for SPELL is on the WAITS disk as SPELL[S,REG] and the master dictionary in SLOVAR[S,REG] (unfortunately the [S,REG] directory is not accessible on saildart.org). The source file has around 5600 lines, 4700 of which are FAIL assembly source code and the rest is the manual. The header reads.

	TITLE	SPELL	I HAVE YOU UNDER MY SPELL
;		SPELLING CHECK  & CORRECTION.
;		R. E. Gorin 20 February, 1971
;		Revised July 23, 1972 III displays
;		TENEX version 1/12/74 Wiiliam W. Plummer, mod REG 11/19/74
;		Additional features, October 1974, Jerry Wolf, mod REG 11/23/74

Internally the program uses a form of hash coding, where words with the same first two characters and length are stored in a list so candidate replacements can be found quickly.

The program detest four types of mistakes; from the manual:

  1. one wrong letter.
  2. one missing letter.
  3. one extra letter.
  4. two transposed letters.

The executable program is built by assembling the code, starting it and giving it a master dictionary file name. It then builds its hash tables and stops, at which point the core image is saved for future use. This was a common technique for machines of this area. as the resulting core file starts up quickly as the master dictionary read and parse does not need to take place. The downside is that the master dictionary cannot be changed without rebuilding the program.

Further information

SPELL is documented in SPELL.REG[UP,DOC]

Here's a video of Ralph Gorin accepting an award for his work on SPELL at a SAIL reunion in 2009.

See Les Earnest's paper on the first spell checker at archive.org.

Questions, corrections, comments

I welcome any questions or comments, and also especially any corrections if I have got something wrong. Please email me at rupert@timereshared.com and I will add it here and update the main text.