lua.wetgenes.txt.words
(C) 2023 Kriss Blank and released under the MIT license, see http://opensource.org/licenses/MIT for full license text.
local wtxtwords=require("wetgenes.txt.words")
See https://github.com/xriss/engrish for source of words and possible alternative licenses.
lua.wetgenes.txt.words.load
yes = wtxtwords.check(word)
This is a fast check if the word exists.
May call wtxtwords.load() to auto load data.
lua.wetgenes.txt.words.transform
list = wtxtwords.transform(word,count,addletters,subletters)
Returns a table of upto count correctly spelled words that you may have miss spelt given the input word ordered by probability.
If the input word is spelled correctly then it will probably be the first word in this list but that is not guaranteed.
addletters is the maximum number of additive transforms, the higher this number the slower this function and it defaults to 4.
subletters is the maximum number of subtractive transforms and will not have much impact on speed, this defaults to the same value as addletters.
We run subletters subtractive transforms on our starting word and then we scan all possible words and perform addletters number of subtractive transforms on them and see if they match any of the transforms we built from our starting word. A match then means we can add up the number of transforms on both sides and that is how many steps it would take to get from one word to another by adding and subtracting letters.