correct the spelling of a given word
SpellCorrectWord( word )
SpellCorrectWord( word, wordlist )
(optional) ordered list or array of strings
The SpellCorrectWord command will try to return a word that closely matches the spelling of the given word. If it cannot find a close match it will return the given word; otherwise, the word returned will be from the internal word list or from the wordlist provided.
In many cases there are many candidates for a misspelled word that are equally good. This command picks the first of these candidates to be returned. Priority will be given to the first equal candidate found in the wordlist when provided.
The optional wordlist is a group of words that either extends the dictionary or provides context as to which words are likely to appear. For example, "snak" will normally be corrected to "sank", but if the context is a group of essays on wild animals in which the word "snake" frequently appears, an ordered list generated from those essays will lead to a more appropriate correction.
A near match is found if a single character deletion, character replacement, character insertion, or transposition of characters results in a word found in the internal word list. Matching when an optional short-list of words is provided is done by computing the Levenshtein distance between the given word to each word in the short-list, and returning the best match provided it is a sufficiently close match.
This function is part of the EssayTools package, so it can be used in the short form SpellCorrectWord(..) only after executing the command with(EssayTools). However, it can always be accessed through the long form of the command by using EssayTools[SpellCorrectWord](..).
sentence ≔ It is rahter dangeros to automagically appli corections
sentence≔It is rahter dangeros to automagically appli corections
mwords ≔ Misspellings⁡sentence
corrections ≔ seq⁡w=SpellCorrectWord⁡w,w∈mwords
forcincorrectionsdosentence ≔ StringTools:-SubstituteAll⁡sentence,lhs⁡c,rhs⁡c;print⁡sentenceend do:
It is rafter dangeros to automagically appli corections
It is rafter dangers to automagically appli corections
It is rafter dangers to automatically appli corections
It is rafter dangers to automatically apple corections
It is rafter dangers to automatically apple corrections
The EssayTools[SpellCorrectWord] command was introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
Download Help Document