A node module for the undocumented google spell API


A simple node.js module for accessing the (undocumented) Google Toolbar spellchecker API. It would probably be a good idea to only use this module for personal projects or things that will only have light traffic, as Google could yank acess to that API at any time for any reason.

The usual...

npm install googlespell


var googlespell = require('googlespell');

googlespell exposes a Checker object which will handle doing the spell checking. It takes one input parameter, config;

var googlespell = require('googlespell');
var checker     = new googlespell.Checker(options);
ignoreDupes:    Ignore duplicates. // (default: false)
ignoreDigits:   Ignore numbers. // (default: true)
ignoreCaps:     Ignore caps. // (default: true)
ignoreHtml:     Remove all HTML tags, keeping inner HTML. // (default: true)
ignoreCode:     Completely remove all <code> tags. // (default: true)
language:       Language to check against. // (default: 'en')
threshold:      Filter suggestions based on Google's confidence level. // (default: 0)

Once the checker is initialized call the .check method.

Checker.check(text, callback(err, result));


var googlespell = require('googlespell');
var checker     = new googlespell.Checker();

checker.check('This is an exmaple', function(err, result) {

googlespell will return a Result object which has an array of suggestions. Each suggestion contains the following properites:

confidence -- How confident Google is about this suggestion
context -- A snippet of the word within the source string
offset -- Position in source string where word is
word -- The word Google things is misspelled
words -- Suggestions for what that word might be

In the above example, the suggestion returned would look like this:

{ offset: 12
  confidence: 1
  word: 'exmaple',
  words: [ 'example', 'ex maple', 'ex-maple', 'exampled', 'examples' ],
  context: 'This is an [exmaple]' }