Class: Aspell
The functionality of Aspell is accessible via this class.
Constants
| Name | Value |
|---|---|
| ULTRA | Fastest mode. Look only for sound-a-likes within one edit distance. No typo analysis.; |
| NORMAL | Normal speed mode. Look for sound-a-likes within two edit distances, with typo analysis.; |
| FAST | Fast mode. Look for sound-a-likes within one edit distance, with typo analysis.; |
| BADSPELLERS | Slowest mode. Tailored for bad spellers.; |
Public Class Methods
CheckerOptions ()
Returns a list of checker options.
DictionaryOptions ()
Returns a list of dictionary options.
FilterOptions ()
Returns a list of filter options.
MiscOptions ()
Returns a list of misc options.
RunTogetherOptions ()
Returns a list of run-together options.
UtilityOptions ()
Returns a list of utility options.
list_dicts ()
Returns a list of AspellDictInfo-objects describing each dictionary.
new (language, jargon, size, encoding)
Creates an Aspell instance. All parameters are optional and have default values. In most situations it is enough to create an Aspell-instance with only a language.
- language - ISO639 language code plus optional ISO 3166 counry code as string (eg: "de" or "en_US").
- jargon - A special jargon of the selected language.
- size - The size of the dictionary to chose (if there are options).
- encoding - The encoding to use.
Public Instance Methods
add_to_personal (word)
Add a word to the private dictionary.
add_to_session (word)
Add a word to the session ignore list. The session persists for the lifetime of self.
check (word)
Check given word for correctness. Returns true or false.
clear_session ()
Clear the the session wordlist.
correct_file (filename)
Check an entire file for correctness. This method requires a block, which will yield each misspelled word.
correct_lines (array_of_strings) {|| ...}
Check an array of strings for correctness. This method requires a block, which will yield each misspelled word.
get_option (option)
Value of an option in config. Returns a string.
get_option_as_list (option)
Value of option in config. Returns a list of strings.
list_misspelled (array_of_strings)
Returns a list of all words in the passed array that are misspelled.
personal_wordlist ()
Return a list of words inside the private dictionary.
save_all_word_lists ()
Sync changed dictionaries to disk.
session_wordlist ()
Return the session wordlist.
set_option (option, value)
Set a passthrough option to a value. Use the strings "true" and "false" for true and false.
suggest (word)
Returns an array of suggestions for the given word. Note that suggest returns multiple corrections even for words that are not wrong.
suggestion_mode= (mode)
Sets the suggestion mode. Use Aspell::ULTRA, Aspell::FAST, Aspell::NORMAL, or Aspell::BADSPELLERS as the parameter.