A JavaScript implementation of the Symmetric Delete spelling correction algorithm.
JavaScript HTML
Pull request Compare This branch is 6 commits ahead of IceCreamYou:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.jscs.json
.npmignore
Gruntfile.js
README.md
demo.html
package.json
symspell.js
test.node.js

README.md

Forked from Isaac Sukin's SymSpell, the code can run on nodejs now, to support chinese words, you need to write a custom tokenizer, see demo:

run npm install symspell first.

demo:

#! /usr/local/bin/node
var assert = require('assert');
var SpellChecker = require('symspell');

function tokenizer(words){
    return words.toLowerCase().split(' ');
}

var maxEditDistance = 4;

var corrector = new SpellChecker(maxEditDistance);

corrector.addWords('adapt adept adopt appraise apprise 暴露 毕恭毕敬', null, tokenizer);

console.log(corrector.lookup('adept'));
console.log(corrector.lookup('apprese'));

assert.equal(corrector.lookup('adept').length, 3);

console.log(corrector.lookup('曝露'));
console.log(corrector.lookup('必恭必敬'));

assert.equal(corrector.lookup('曝露')[0].term, '暴露')
assert.equal(corrector.lookup('必恭必敬')[0].distance, 2)

An implementation of the Symmetric Delete spelling correction algorithm. It is fast and language-independent, but there is some setup cost to construct the dictionary.

Currently the results are not as accurate as expected; there are probably some bugs in the port.

Based on C# code and algorithm version 1.6, originally written by Wolf Garbe.

License: LGPL 3.0