Simple expandable tool for spell checking
Readme: English
Русский
- English
- Russian
Install:
npm i spell-checker-js
Code
const spell = require('spell-checker-js')
// Load dictionary
spell.load('en')
// Checking text
const check = spell.check('Some text to check, blahblahblah, olololo')
console.log(check)
// -> ['blahblahblah', 'olololo']
Examples:
// ways for load default dictionary:
spell.load('ru')
spell.load({ input: 'ru' })
// load custom dictionary with utf-8:
spell.load('./my_custom_dictionary.txt')
// laod custom dictionary with charset:
spell.load({ input: './my_custom_dictionary.txt', charset: 'windows-1251' })
// Asynchronous load default dictionary:
spell.load({ input: 'en', async: true }).then(len => {
console.log(len);
// len — amount of added words to base
spell.check('something')
})
List of default dictionaries:
en
— list of English wordsru
— list of Russian wordsru_surnames
— list of Russian surnames
You can help by adding other languages or expand existing dictionaries
Returns: array of wrong words
Example:
spell.load('en')
const check = spell.check('Some text to check, blahblahblah, olololo')
console.log(check)
// -> ['blahblahblah', 'olololo']
Example:
spell.load('en')
spell.clear()
spell.check('something')
// -> ERROR! Dictionaries are not loaded
Example
spell.load('en')
spell.load('ru')
console.log(spell.size)
// -> 1956898
MIT © 2016 Danakt Frost