nodehun
Version:
The Hunspell binding for nodejs that exposes as much of hunspell as possible and also adds new features. Hunspell is a first class spellcheck library used by Google, Apple, and Mozilla.
12 lines (7 loc) • 487 B
JavaScript
const Nodehun = require('bindings')('Nodehun')
const dictionaries = require('./dictionaries')
const nodehun = new Nodehun(dictionaries.en_US.affix, dictionaries.en_US.dictionary)
const wordCharacters = nodehun.getWordCharacters()
console.log('Dictionary\'s word characters are:', wordCharacters) // => 0123456789'.-’
const wordCharactersUTF16 = nodehun.getWordCharactersUTF16()
console.log('Dictionary\'s word characters (UTF-16) are:', wordCharactersUTF16) // => '-.0123456789’