All Projects → montanaflynn → Spellcheck-API

montanaflynn / Spellcheck-API

Licence: other
HTTP spellcheck API powered by hunspell

Programming Languages

javascript
184084 projects - #8 most used programming language

Spellcheck API

HTTP spellcheck API based off hunspell.

The API server needs node version 0.11.0 or higher and to be ran with the --harmony flag.

Install

git clone [email protected]:montanaflynn/Spellcheck-API.git
npm install

Usage

node --harmony ./server.js [port]

Default port is 8080.

Example

node --harmony server 1337 &
curl "localhost:1337?text=wrng"
{
  "original": "wrng",
  "suggestion": "wrong",
  "corrections": {
    "wrng": [
      "wrong",
      "wing",
      "wring",
      "wrung"
    ]
  }
}

Responses

If there is no text querystring parameter return error message:

{"error":"Missing 'text' query parameter"}

If there are no mistakes return false for suggestion.

{
  "original": "the words are fine.",
  "suggestion": false
}

If there are mistakes but no suggestions return null for suggestion and corrections.

{
  "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.

{
  "original": "thefdeee123 is theedffdfde is baddd.",
  "suggestion": "thefdeee123 is theedffdfde is bad.",
  "corrections": {
    "thefdeee123": null,
    "theedffdfde": null,
    "baddd": [
      "bad",
      "addd",
      "bddd",
      "badd"
    ]
  }
}

FAQ

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.

Contributing

Forks and pull requests are most welcomed.

License

The MIT License (MIT)

Copyright 2014, Montana Flynn (http://anonfunction.com/)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].