https://github.com/planeshifter/spell-check
simple spelling checker
https://github.com/planeshifter/spell-check
Last synced: 10 months ago
JSON representation
simple spelling checker
- Host: GitHub
- URL: https://github.com/planeshifter/spell-check
- Owner: Planeshifter
- License: mit
- Created: 2015-02-17T06:11:48.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-20T02:50:38.000Z (about 11 years ago)
- Last Synced: 2025-01-22T01:12:44.730Z (over 1 year ago)
- Language: CoffeeScript
- Size: 1.78 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Dependencies][dependencies-image]][dependencies-url]
# spell-check
simple spelling checker
## Introduction
The language model is constructed from the newspaper corpus of
[http://www.corpora.heliohost.org/](http://www.corpora.heliohost.org/),
a collection of corpora for various languages freely available to download and
collected by Hans Christensen. Unigram counts were extracted and stored
in a *sqlite* database for the spell-checker.
## API
### spell( word [, callback] )
Given an input string consisting of a single `word`,
the `spell` function returns the most probable correction according
to an error and language model. If no valid correction can be found,
the original argument is returned.
The function is asynchronous and either calls the `callback` function upon
completion if the parameter is supplied or otherwise
returns a `Promise`.
### Example:
#### Callback Style
JavaScript:
```js
spell("haert", function(err, res){
console.log(res);
});
// returns: heart
```
CoffeeScript:
```coffeescript
spell("haert", (err, res) ->
console.log res
)
# returns: heart
```
#### Using Promises
JavaScript:
```js
spell("lagauge").then(function(res){
console.log(res);
});
// returns: language
```
CoffeeScript:
```coffeescript
spell("langauge").then( (res) -> console.log res )
# returns: language
```
## Unit Tests
Run tests via the command `npm test`
---
## License
[MIT license](http://opensource.org/licenses/MIT).
[npm-image]: https://badge.fury.io/js/spell-check.svg
[npm-url]: http://badge.fury.io/js/spell-check
[travis-image]: https://travis-ci.org/Planeshifter/spell-check.svg
[travis-url]: https://travis-ci.org/Planeshifter/spell-check
[dependencies-image]: http://img.shields.io/david/Planeshifter/spell-check.svg
[dependencies-url]: https://david-dm.org/Planeshifter/spell-check