typogen
Introduce configurable typos into a string.
Usage
// Require the projectconst Typo = Typo; // This library will load a default config unless one is specified// See bellow for the details of the config structurevar config = ; // Create the Typo objectvar typo = config; // Take a stringlet string = "This is a common string. There are some things we could misspell. Don't forget it's random!"; // Introduce typos at randomstring = typo; console;
Configuration
- typoRate is in 10ths of a percent. 1 = 0.1%, 10 = 1%, 100 = 10%.
- typoCommas is to forget commas
- typoApostrophes is to forget apostrophes
- typoCase is to forget to capitalize
- speechParts.string is the word to be misspelled
- speechParts.typos are the randomly chosen typos to introduce
Json Configuration,
Javascript Configuration
var config = typoRate: 100 typoCommas: true typoApostrophes: true typoCase: true speechParts: string: "they're" typos: "theyre" "there" "their" string: "theyre" typos: "there" "their" string: "their" typos: "there" "theyre" string: "there" typos: "theyre" "their" string: "your" typos: "youre" string: "youre" typos: "your" string: "you're" typos: "your" string: "you" typos: "u" string: "ei" typos: "ie" "ee" string: "ie" typos: "ee" "ei" string: "ai" typos: "ia" string: "ia" typos: "ai" string: "qu" typos: "q" ;