Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spell-checker-js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spell-checker-js

Simple expandable tool for spell checking

  • 1.2.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
176
increased by9.32%
Maintainers
1
Weekly downloads
 
Created
Source

Spell-checker.js

Simple expandable tool for spell checking

npm Travis branch

Readme: English Русский

Supported languages

  • English
  • Russian

Quickstart

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']

Methods & properties

spell.load(dictionary) or spell.load(options) — load dictionary file

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 words
  • ru — list of Russian words
  • ru_surnames — list of Russian surnames

You can help by adding other languages or expand existing dictionaries

spell.check(string) — spell checking of text

Returns: array of wrong words
Example:

spell.load('en')

const check = spell.check('Some text to check, blahblahblah, olololo')

console.log(check)
// -> ['blahblahblah', 'olololo']

spell.clear() — clear all loaded dictionaries

Example:

spell.load('en')

spell.clear()
spell.check('something')

// -> ERROR! Dictionaries are not loaded

spell.size — number of words in the dictionary are

Example

spell.load('en')
spell.load('ru')

console.log(spell.size)
// -> 1956898

License

MIT © 2016 Danakt Frost

Keywords

FAQs

Package last updated on 14 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc