Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yefim/autocorrect
:ab: Autocorrect in JS
https://github.com/yefim/autocorrect
autocorrect javascript
Last synced: about 9 hours 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 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-31T14:08:23.000Z (over 5 years ago)
- Last Synced: 2024-10-28T14:25:31.078Z (22 days ago)
- Topics: autocorrect, javascript
- Language: JavaScript
- Homepage: https://npm.im/autocorrect
- Size: 15.6 KB
- Stars: 20
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
autocorrect [![Build Status](https://travis-ci.org/yefim/autocorrect.svg?branch=master)](https://travis-ci.org/yefim/autocorrect)
==============[![NPM](https://nodei.co/npm/autocorrect.png)](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)