Skip to content

s-expressionists/Spell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPELL: spellchecking library for Common Lisp.

Introduction

SPELL is a spellchecking library for Common Lisp. The code of this library is made available under the BSD license. The file file:data/english.txt is made available under the license in file:english.LICENSE.

Loading (possibly after compiling) the spell system may initially take between something like 3 and 60 seconds, depending on the machine and CL implementation, as an English dictionary is loaded, optimized and compiled into a FASL file. Subsequent load operations (without compiling) should finish within well below one second.

For loading the spell system, use

(ql:quickload "spell")

This document gives only a very brief overview and highlights some features. Proper documentation can be found in the file:documentation directory.

Looking up Words

The exported functions for looking up words are spell:english-lookup which accepts a string, and spell:english-check-paragraph which checks a whole paragraph of text and returns a list of conses:

(spell:english-lookup "horse")
(#<EXPLICIT-BASE-VERB "horse" person:ANY number:ANY tense:NIL negative:NIL contraction:NIL strength:WEAK infinitive:SELF {1001089AA3}>
 #<EXPLICIT-BASE-NOUN "horse" number:SINGULAR case:NIL gender:NIL {1001089A73}>)
(spell:english-check-paragraph "In Polish, a horse is koń, and in German, it's
das Pferd.")
((22 . 25) (47 . 50) (51 . 56))

Each cons represents a single word in the paragraph which has failed dictionary lookup, with the car and cdr being offsets in the original string outlining the word.

Obtaining Corrections

The SPELL library exports a few functions that obtain similar words for a given word or corrections for a misspelled word. The most convenient function is spell:english-corrections which returns a list of corrections for a (possibly) misspelled English word;

(spell:english-corrections "lifp" :threshold 1)
("lift" "life" "lip" "lisp" "limp")
NIL

For more ways to use this function as well as the information about the lower-level functions for similar words and corrections, see the main documentation.

Backward Compatibility Notice

The SPELL library provides the spell/simple ASDF system. The difference between the full and the simple version used to be that the simple version answered only “does this word occur in the English dictionary?” with a boolean value, while the full version returns a list of all word meanings associated with that string. However, this difference no longer exists and the spell/simple system is now an alias for the spell system.

The spell/simple system can still be loaded with

(ql:quickload "spell/simple")

About

Spellchecking library for Common Lisp (currently only English)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 3

  •  
  •  
  •