Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robbiethewagner/spelling-suggester
This is a spelling suggester node.js app that I created.
https://github.com/robbiethewagner/spelling-suggester
Last synced: about 1 month ago
JSON representation
This is a spelling suggester node.js app that I created.
- Host: GitHub
- URL: https://github.com/robbiethewagner/spelling-suggester
- Owner: RobbieTheWagner
- Created: 2014-03-07T00:56:13.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-07T21:43:59.000Z (over 10 years ago)
- Last Synced: 2024-10-20T14:14:03.479Z (2 months ago)
- Language: JavaScript
- Size: 779 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spelling Suggester
## Info
This is a spelling suggester node.js app that I created.It uses the npm module csv to parse two CSV files, a list of misspelled words, and another list of dictionary words. It then sorts the dictionary words by frequency of use.
After parsing the two files, and loading them into arrays, it iterates through each array, and calculates the Damerau-Levenshtein distance between the correct words in the dictionary and the misspelled words to determine which words match to be used as spelling correction suggestions.
To write my Damerau-Levenshtein function, I referenced the explanation and pseudocode on the [Wikipedia](http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance) page. Once I implemented the basic algorithm, I reversed a couple of my for loops and changed a call to ```Math.min``` to my own written min function instead. This brought the execution time down a considerable amount.
I used Mocha for testing and Chai to do assertions. The tests are located in the test folder.
## Run
To run the app, you must have node and npm installed on your machine. If you do not, please go [here](http://nodejs.org/download/) and download node for your machine.Once node and npm are installed, you are ready to run the app.
To run the app, simply download the zipped version of this code and unzip it. Then cd to the directory you saved it in. For example:
```bash
cd spelling-suggester-master
```Then, all you have to do is run:
```bash
node app.js
```You will not see any output in the terminal, but the program is running. When it completes, in ~45 seconds, it will print to the console the number of words found and the time it took to execute. Also, it will have generated a suggestions.txt file in the root of the project. You can then view that to see the suggestions for each misspelled word.
To run the tests for the app, while still in the root of the project, simply run:
```
npm test
```This will run the tests using Mocha, and output the results.