Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

codeeverything/node-spell-checker

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeJS Spell Checker

Uses BK Trees and Levenstein Distance to provide spelling correction suggestions via a simple API.

Originally inspired by Peter Norvig's essay on spell checking, and the references therein.

Usage

Run server.js:

$ node server.js

Navigate to the API endpoint /api/:word, for example:

/api/speling, and you'll be returned an array of possible corrections:

[
  "spelling",
  "dueling",
  "peking",
  "seeing",
  "sewing",
  "spring",
  "spying",
  "splint",
  "piling"
]

Generating the dictionary

A default dictionary file is provided in data/dic.json, but you can run node gendic.js if you want to generate your own. Simply change this line var files = ['big.txt']; so that the array contains your own source text file (should be the only entry).

Improvements

  • Define some statistical model to better rank the suggestions. Cues could be taken from Peter Norvig's essay by using term frequency from the dictionary source text.
    • Based on previous correction selections
    • Based on common misspellings of words
    • With context of surrounding words/grammer

About

Simple Spell Checker in NodeJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.