[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Spelling correction

    Date: Mon, 20 Jan 86 13:56 EST
    From: David C. Plummer <DCP@SCRC-QUABBIN.ARPA>

	Date: Mon 20 Jan 86 09:48:22-PST
	From: Rene Bach <BACH@SU-SCORE.ARPA>

	I am new on this list (please forgive me if this topic has been discussed

	It has been our experience that using the spelling correction facilities
	provided by Interlisp are very useful to provide nice user interfaces.
	It is also my belief that to do flexible symbol matching requires
	spelling correction.

	My question is: why doesn't CL include a specification for a spelling
	correction function. The description of the Interlisp functions could be
	used as specification for the I/O. The choice of the algorithm could
	be left open.

    Base my following reaction on never having used Interlisp but only heard
    about it and some of its 'features.'

You are somewhat under-informed about the Interlisp spelling corrector.  Here's
the straight scoop from one who knows.

Underlying everything, Interlisp has a function called FIXSPELL which has
lots of optional arguments, but which essentially checks a "misspelled" 
symbol against a specified list of possible corrections.  The parameters
control how FIXSPELL responds to spelling errors or various degrees of 
severity.  Depending on the various severity thresholds and the response
specification, FIXSPELL can return a "correction" without comment, with
a comment/warning message, with a Y-OR-N-P type response, or with an

Interlisp has several mechanisms for automatically maintaining "spelling lists";
for example, it keeps a lists of "system" functions "system" variables, 
"user" functions and "user" variables.

DWIM is an entirely separate facility, which among other things, can
invoke FIXSPELL to attempt to find a correction.   This is the use of
the spelling corrector which is most often encountered by the casual
Interlisp user.   Forms you type to a lisp listener are passed to DWIM
if an error occurs, and (various switches permitting) FIXSPELL can be
invoked to find semantically reasonable corrections.   DWIM (and
therefore FIXSPELL) are also invoked by the compiler.   Due to the
form-based nature of Interlisp's environment, changes made by DWIM
are automatically propagated to the sources.  2All 0changes made
by DWIM are undoable.

Summary:  FIXSPELL is a utility which we could use.  DWIM is a completely
separate facility, which is controversial even within the Interlisp community.
Most of use have a love/hate relationship with it, but few choose to turn it


    The only 'spelling corrector' I've heard of in Interlisp is a DWIM
    facility to change the name of variables out from under you because you
    mistyped them.  I don't believe in that kind of programming, since that
    will, among other things, hide bugs that will resurface indefinitely
    later if you happen to name a variable the same as your previous

This is a misconception; DWIM (as used by the compiler) actually fixes
the sources, so the bug won't resurface later.  The choice to fix
the sources "silently" "noisily" or "with confirmation only" is
available to the user.   The really important thing you apparently
didn't know is that when DWIM fixes something it2 stays0 fixed; So 
today's Error-fixed-by-dwim doesn't become tomorrow's non-bug
because *BAX* is now defined.

For example, if in a lispm compilation you get the warning "Function foo-bax-mumble is undefined",
DWIM might instead have run an interaction such as

	Function FOO-BAX-MUMBLE is undefined.  Do you mean FOO-BAR-MUMBLE? 

and if you respond Y, it fixes the source for you once and for all.  I always
found this extremely user-friendly, since DWIM was almost always right and 
since it saved me the trouble of doing another edit-compile cycle.