Finds the best matching word using the first smallest Levenshtein distance.
Default options (uses word-list as dict)
var autocorrect = require('autocorrect')()
autocorrect('mbryo') // embryo
var path = '/usr/share/dict/words'
var autocorrect = require('autocorrect')({dictionary: path})
autocorrect('mbryo') // embryo
var words = ['word', 'weird', 'wired']
var autocorrect = require('autocorrect')({words: words})
autocorrect('wared') // wired
words
- a list of words to use for matchingdictionary
- path to dictionary file