npm install spellcheck-apiHTTP spellcheck API based off hunspell.
__The API server needs node version 0.11.0 or higher and to be ran with the --harmony flag.__
``sh`
git clone git@github.com:montanaflynn/Spellcheck-API.git
npm install
node --harmony ./server.js [port]
Default port is 8080.
`sh`
node --harmony server 1337 &
curl "localhost:1337?text=wrng"
`json`
{
"original": "wrng",
"suggestion": "wrong",
"corrections": {
"wrng": [
"wrong",
"wing",
"wring",
"wrung"
]
}
}
If there is no text querystring parameter return error message:
`json`
{"error":"Missing 'text' query parameter"}
If there are no mistakes return false for suggestion.
`json`
{
"original": "the words are fine.",
"suggestion": false
}
If there are mistakes but no suggestions return null for suggestion and corrections.
`json`
{
"original": "dfdgdfg is gfdgdfsg.",
"suggestion": null,
"corrections": {
"dfdgdfg": null,
"gfdgdfsg": null
}
}
If there are mistakes and suggestions return an array for each correction and replace the word in the suggestion string.
`json``
{
"original": "thefdeee123 is theedffdfde is baddd.",
"suggestion": "thefdeee123 is theedffdfde is bad.",
"corrections": {
"thefdeee123": null,
"theedffdfde": null,
"baddd": [
"bad",
"addd",
"bddd",
"badd"
]
}
}
Didn't this use to be a PHP project?
Yes indeed, however the PHP version is no longer supported. The source code is still available.
Forks and pull requests are most welcomed.
The MIT License (MIT)
Copyright 2014, Montana Flynn (http://anonfunction.com/)