Next: , Previous: , Up: Top   [Contents][Index]

1 Reference

The Aspell library provides spell checking functionality.

To use this library, first the module must be imported, like this:

(use-modules (aspell))

Then, before any attempt to use it for spell checking, a dictionary must be chosen. If the aspell command line tool was installed when the Aspell library was installed, the available dictionaries can be listed from the command line by using the aspell dump dicts command.

To set the library, use the aspell-set-lang procedure.

Procedure: aspell-set-lang lang

Sets the dictionary for this aspell session to lang, where lang is a string containing a the standard two letter ISO 639 language code, with an optional two letter ISO 3166 country code after an underscore. For example, lang could be "en_US" or "en_GB" or perhaps simply "es". The lang string must match the name one of aspell’s installed dictionaries, as described above.

You may call this function at any time, but, each time the language is changed, it will cause any words added to the default speller using aspell-add-word to be forgotten.

On success, the procedure will return #t. On failure, it will throw an error.

A program may have one or more spellers. A speller holds a list of words temporarily added to the dictionary using aspell-add-word as well as a list of suggested replacements added using aspell-store-replacement. A default speller is created when the library is loaded, and extra spellers can be made using aspell-new-speller. The rest of the procedures will take an optional speller argument. If the optional speller argument is not supplied, the default speller is used instead.

Procedure: aspell-new-speller

This procedure returns a new speller of the type #<AspellSpeller>. A speller stores words temporarily added to the dictionary for this session, as well as suggested word replacement pairs.

Procedure: aspell-speller? x

Returns #t if x is a #<AspellSpeller> type.

With that out of the way, we can get down to business.

Procedure: aspell-correct? word [speller]

Returns #t if word appears in the current dictionary, or #f otherwise. If speller is supplied, its list of added words is used.

Procedure: aspell-word word [speller]

This procedure returns a list of words that are possible spelling corrections to word. If speller is supplied, that speller’s list of added words and suggested replacements is used.

Procedure: aspell-add-word word [speller]

This procedure adds the word word to the dictionary for this session. If speller is supplied, it adds it to the dictionary for that speller, otherwise it adds it to the default dictionary.

Procedure: aspell-store-replacement misspelled correct [speller]

This makes the correctly spelled word the preferred replacement for a given mispelled word. In a list of suggested corrections supplied by aspell-word, correct will appear with high priority when aspell-word is called with mistake. If a speller is supplied, it adds this suggestion to that speller, otherwise it adds it to the default list.

The return value is unspecified.

Next: , Previous: , Up: Top   [Contents][Index]