Skip to content
pmv718 edited this page Mar 24, 2017 · 17 revisions

Domain based Spell Checker

If a word or sentence is passed as an argument to the spell checker, the following are the possibilities:
When you pass a word or sentence as an argument to the spell checker, it performs the following steps:
1. Checks whether or not the word is present in the built-in dictionary. If present, the word is assumed to be
correct.
2. If the check against the dictionary fails, the module looks into the corpus to retun the correctly spelled word. To optimally use the Spell Checker for more accurate match, update the corpus with words based on your project
domain, such as Travel, Insurance, and Entertainment. You can locate the corpus as domainSpecificWords.txt inside
the corpus folder.
A separate corpus is maintained so that if your website is regarding 'travel', you can put your own words in the domainSpecificWords file(corpus folder) which reduces the time for replacing each wrong word as it doesn't have to loop through the entire English dictionary consisting of lakhs of words. Mostly the spell corrected word is an exact match which the user literally meant.

Welcome!! Please follow these steps before using domain-based spell-checker in your project


Steps :

npm install domain-based-spellchecker

Test :

mocha test

Uses :

main.js :

let spellcheck = require('domain-based-spellchecker');
let wrongWord = 'travl by bs';
let correctSpell = spellcheck(wrongWord);
console.log('Wrong word : '+wrongWord);
console.log('Corrected word : '+correctSpell.query);

Known issues :

Currently domain-based spell checker supports only one edit as default.

Road map :

A more enhanced version of this should be able to modify its edits for each word to bring up an exact corrected match for the wrong word.

Clone this wiki locally