1.0.4 • Published 5 years ago

js-spell-checker v1.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

js-spell-checker

Installation

npm i js-spell-checker -g

Usage

$ spell-checker c <dictonary-file> <file-to-check>

Limitations

The dictonary/file-to-check files must be plain text (*.txt). The words within those files must be seperated by new lines. I've provided a file-to-check in this repo with common misspellings that I used during testing. You can also find a dictonary file within this repo. The dictonary does not have every word like 'Friday', so before you assume it's broken check to see if the word exists in the dictonary.

Example Output

screen shot 2019-01-17 at 11 35 17 am

How does it work?

  1. A dictonary and a file to check for spelling errors are provided as command line arguments.
  2. Those files are read as plain text and parsed into Arrays.
  3. The file to check array is matched against the dictonary array. Any differences in the file to check array can be assumed as a misspelled word.
  4. The user is provided feedback in the console, that feedback consists of the misspelled word, the line number to find the misspelled word and suggestions on what they might have meant to spell.
  5. The suggestions are determined by breaking up each misspelled word into an array of characters. Those characters are looped over and transformed using characters out of an alphabet array.
  6. The suggestions are then matched against the dictonary to determine if the suggestion is indeed a word.
  7. The results are output to the console for the user to read.
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago