Interface to GNU Aspell
1 Using aspell
1.1 Controlling aspell
aspell?
open-aspell
close-aspell
aspell-logger
1.2 Spell checking
aspell-check
1.3 Dictionaries
aspell-add-word
aspell-get-dictionary
aspell-save-dictionary
1.4 Other functions
aspell-active?
aspell-language
2 Using other spell checkers
aspell-executable-path
aspell-compatibility-mode
8.12

Interface to GNU Aspell🔗ℹ

 (require aspell) package: aspell

Provides an interface to GNU ASpell for spell-checking text from your programs. The aspell program must be present in your path, or a path to it explicitly provided.

1 Using aspell🔗ℹ

1.1 Controlling aspell🔗ℹ

procedure

(aspell? obj)  boolean?

  obj : any/c
Test if a value is an aspell instance.

procedure

(open-aspell [#:aspell-path aspell-path    
  #:dict dict    
  #:personal-dict personal-dict    
  #:dict-dir dict-dir    
  #:lang lang    
  #:mode mode    
  #:ignore-case ignore-case])  aspell?
  aspell-path : path-string? = (aspell-executable-path)
  dict : (or/c string? #f) = #f
  personal-dict : (or/c path-string? #f) = #f
  dict-dir : (or/c path-string? #f) = #f
  lang : (or/c string? #f) = #f
  mode : (or/c symbol? #f) = #f
  ignore-case : boolean? = #f
Start a new aspell instance. If any of the options are false, values are chosen by aspell from its defaults and the current locale. Generally this is the desired behavior. See its documentation for details.

aspell dump modes from a command line will give the possible values for the #:mode option.

procedure

(close-aspell speller)  void?

  speller : aspell?
Close a running aspell instance and resources associated with it. It should not be used after calling this function.

The logger object warnings and informational messages are sent to.

1.2 Spell checking🔗ℹ

procedure

(aspell-check speller text)  list?

  speller : aspell?
  text : string?
Spell check the given text and return a list of misspelled words. Each element of the list is itself a list. The first element is the misspelled word, the second is its position from the start of the line it’s in (Not the start of the string if there are multiple lines), and any remaining elements are suggested correct words, if any.

Care must be taken that any single line isn’t larger than your system’s pipe buffer space.

1.3 Dictionaries🔗ℹ

In addition to the master dictionary, aspell supports personal dictionaries and a temporary session dictionary of accepted words. The personal dictionary can include suggested replacment words for given misspellings, or just words to accept as correctly spelled.

procedure

(aspell-add-word speller word [dict])  void?

  speller : aspell?
  word : string?
  dict : (or/c string? 'personal 'session) = 'session
Add a new word to the given dictionary, or add a misspelled word and suggested replacement to the personal dictionary.

procedure

(aspell-get-dictionary speller dict)  (listof string?)

  speller : aspell?
  dict : (or/c 'personal 'session)
Return a list of the words in the given dictionary.

procedure

(aspell-save-dictionary speller)  void?

  speller : aspell?
Save the personal dictionary.

1.4 Other functions🔗ℹ

procedure

(aspell-active? speller)  boolean?

  speller : aspell?
Returns true if the aspell instance is active, false if it’s been closed.

procedure

(aspell-language speller)  string?

  speller : aspell?
Return the language being used for spell checking.

2 Using other spell checkers🔗ℹ

While this module is intended primarly for use with aspell, it can work with other spell checkers that have a compatible command line interface - the traditional ispell and hunspell are also supported, albeit with reduced functionality. To use them, set the aspell-compatibility-mode parameter and pass the appropriate :aspell-path argument to open-aspell or set aspell-executable-path.

parameter

(aspell-executable-path)  (or/c path-string? #f)

(aspell-executable-path aspell-path)  void?
  aspell-path : (or/c path-string? #f)
 = (find-executable-path "aspell")
The default path to a spell checker binary.

parameter

(aspell-compatibility-mode)  (or/c 'aspell 'ispell 'hunspell)

(aspell-compatibility-mode mode)  void?
  mode : (or/c 'aspell 'ispell 'hunspell)
 = 'aspell
Set to the spell checker being used if it’s not aspell.