GithubHelp home page GithubHelp logo

misspell's Introduction

Misspell

This is a JavaScript reverse spellchecker. It takes words and screws up the spelling and capitalisation.

Usage

Include misspell.js in your project with a <script> tag or via npm install misspell. Then you can require it and use it right away!

var misspell = require("misspell") // if you haven't included it with a script tag

var misspelledText = misspell(text, capitalisation[, capsTypes, mispellPercent])
// text: the string you would like to process
// capitalisation: boolean, set this to true or false depending on if you want the capitalisation to be changed.
// capsTypes (optional): an array of the capitalisation modes you want to enable. of the array of modes you supply, a random mode will be chosen. if you don't supply an array of specific modes, a random mode will be chosen out of every possible mode.
    // LIST OF CAPITALISATION MODES
    // mode 1: jaden smith mode, capitalises the first letter of each word in the string
    // mode 2: random jaden smith mode, sometimes capitalises the first letter of randomly picked words from the string
    // mode 3: uppercase mode, makes whole string uppercase
    // mode 4: lowercase mode, makes whole string lowercase
    // mode 5: totally screwed up mode, each character is randomly made uppercase or lowercase
    // mode 6: "tumblr" mode, begins a string normally and eventually at a random place goES INTO ALL CAPS AND CONTINUES TO BE ALL CAPS UNTIL THE END OF THE STRING
// an example of a value you can supply for capsTypes is [1, 3, 5], which only allows jaden smith mode, uppercase mode, and totally screwed up mode.
// misspellPercent (optional): percent likelihood of messing up with spelling.

You can also play around with misspell.js like a CLI. Run it with node and pass the same arguments you'd pass to it as a function in the same order and it'll pipe out the result.

Reverse Spellcheck Dictionary

Part of what made this project possible is the Wikipedia machine readable list of common misspellings. I wrote a script to take that and make it into a nice JSON file, which sits in the folder reverse-spellcheck/. Feel free to use it to serialize your own files.

Close Letters On Keyboard JSON File

This is a JSON file that includes each letter on a QWERTY keyboard and an array with the surrounding letters. Feel free to use it anyplace you like.

Using Misspell On The Client Side

If you plan to use Misspell in a web based HTML document, it is important to include the failsafe file misspell-dependencies.js in a place accessible by Misspell. This is in place because Misspell needs the files keyboard-close.json and reverse-spellcheck.json, and while it tries to run an HTTP request to get them, it doesn't always work due to CORS, disorganization, and many other potential issues.

License

The reverse spellcheck JSON file is under public domain. I didn't think I'd need to copyright it considering I didn't really make it myself, I just formatted it right.

The rest of the code is under the MIT License, © Ethan Arterberry 2016.

misspell's People

Contributors

ethel-dev avatar

Watchers

Edita avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.