https://github.com/yefim/autocorrect
:ab: Autocorrect in JS
https://github.com/yefim/autocorrect
autocorrect javascript
Last synced: about 1 year ago
JSON representation
:ab: Autocorrect in JS
- Host: GitHub
- URL: https://github.com/yefim/autocorrect
- Owner: yefim
- License: mit
- Created: 2016-02-24T10:12:30.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-05-31T14:08:23.000Z (about 7 years ago)
- Last Synced: 2025-04-19T03:36:19.115Z (about 1 year ago)
- Topics: autocorrect, javascript
- Language: JavaScript
- Homepage: https://npm.im/autocorrect
- Size: 15.6 KB
- Stars: 21
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
autocorrect [](https://travis-ci.org/yefim/autocorrect)
==============
[](https://www.npmjs.com/package/autocorrect)
Finds the best matching word using the first smallest Levenshtein distance.
## Usage
### Default options (uses [word-list](https://github.com/sindresorhus/word-list) as dict)
````javascript
var autocorrect = require('autocorrect')()
autocorrect('mbryo') // embryo
````
### Custom dictionary path
````javascript
var path = '/usr/share/dict/words'
var autocorrect = require('autocorrect')({dictionary: path})
autocorrect('mbryo') // embryo
````
### Custom words
```` javascript
var words = ['word', 'weird', 'wired']
var autocorrect = require('autocorrect')({words: words})
autocorrect('wared') // wired
````
## Options
* `words` - a list of words to use for matching
* `dictionary` - path to dictionary file
## Contributors
* [Yefim Vedernikoff](https://twitter.com/yefim)