Skip to content

lukemeierj/gibberish.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gibberish.js

Effective Gibberish Detection for Clientside Input Verification

A JavaScript tool to detect gibberish text.

Based on Rob Neuhaus's Gibberish Detector, described in his repo.

Using a transition matrix generated from Neuhaus' program, gibberish.js classifies text using a two charachter Markov Chain on the client side.

Examples

console.log(Gibberish.isGibberish('hey there buddy')) // => false
console.log(Gibberish.isGibberish('hey asfgdsdfhgsdgh buddy')) // => true
console.log(Gibberish.isGibberish('i really like markov chains')) // => false
console.log(Gibberish.isGibberish(';sdfkhgas')) // => true

To change the threshold for what is classified as gibberish and what is not, modify the matrix object.

Gibberish.matrix['thresh'] = 0.04; // default
Gibberish.matrix['thresh'] = 0.02; // the threshold chosen by Neuhaus' method
Gibberish.matrix['thresh'] = 0.06; // fairly strict, more likely to misclassify valid strings 

About

A JavaScript tool to detect gibberish text

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published