Not sure this forum is the place to be doing payments for such things. Not to say that there should or should not be, but there’s certainly an ethos of trying to be helpful. In that vein, here’s something I’ve quickly put together that might do the sort of thing being asked for.
Here’s the “gibberish” function I created. It takes two parameters. the first is the string to convert to something more like gibberish. The second parameter is a way of specifying how often a character is mis-typed. For example if you pass in 1000
, one in every thousand characters will be changed from the original. If you enter 10
it will be one in every ten characters, so you can specify just how badly typed something can be.
//Pass in a string where every 1 in so many characters is accidentally mis-typed
function gibberish(p_strInput, p_intOneIn)
{
//Characters that can be mis-typed
const SHIFTABLE = "abcdefghijklmnopqrstuvwxyz";
//JSON describing what each shiftable character can be shifted to
const jsonGibber = {};
jsonGibber.a = "qwsz";
jsonGibber.b = "vghn";
jsonGibber.c = "xdfv";
jsonGibber.d = "serfxc";
jsonGibber.e = "wsdr";
jsonGibber.f = "drtgvc";
jsonGibber.g = "ftyhbv";
jsonGibber.h = "gyujnb";
jsonGibber.i = "ujko";
jsonGibber.j = "huikmn";
jsonGibber.k = "mjiol";
jsonGibber.l = "pok";
jsonGibber.m = "njk";
jsonGibber.n = "bhjm";
jsonGibber.o = "iklp";
jsonGibber.p = "ol";
jsonGibber.q = "aw";
jsonGibber.r = "edft";
jsonGibber.s = "awedxz";
jsonGibber.t = "rfgy";
jsonGibber.u = "yhji";
jsonGibber.v = "cfgb";
jsonGibber.w = "qase";
jsonGibber.x = "zsdc";
jsonGibber.y = "tghu";
jsonGibber.z = "asx";
let strReturn = "";
//Process every character in the text passed in
for (var intCounter = 0; intCounter < p_strInput.length; intCounter++)
{
//For convenience, let's put the character in a variable
let strChar = p_strInput[intCounter];
//Is this character to be shifted to another character?
if(Math.floor(Math.random() * p_intOneIn) + 1 == 1)
{
//Is the character we're intending to shift in our shiftable list?
if(SHIFTABLE.includes(strChar))
{
//Get a random new character
//let newChar = randCharFromString(jsonGibber[strChar]);
let newChar = jsonGibber[strChar][Math.floor(Math.random() * jsonGibber[strChar].length)]
//If the old character is upper case, make the new character upper case
if (strChar === strChar.toUpperCase()) newChar = newChar.toUpperCase();
//Replace the character
strChar = newChar;
}
}
strReturn += strChar;
}
//Return the updated string
return strReturn;
}
First of all, I’d just based the mistyping on a standard alphabet. No accents or additions, no symbols. No numbers. These could of course be added in with a little additional effort.
When a character is mistyped, it looks up a character that is nearby. I just based the mistypings on the keys on my Apple QWERTY keyboard where there is reasonable overlap with a side of that character’s key. It doesn’t take into account any other keyboard types, statistical occurrences of common mis-typing or mis-spelling. It is just an equally likely slip in any direction on the qwerty keyboard that would result in another letter.
You could tailor the shifts to suit, and apply biases simply by repeating letters in the strings. For example, I believe it is much more likely that you would accidentally type an “a” or “d” instead of an “s” than a “w”, “e”, “z” or “x”. I could increase the likelihood of that simply by amending the ‘gibber’ string like this, making them five times more likely to occur.
jsonGibber.s = "aaaaawedddddxz";
I would suggest that with a bit of research and a bit of tinkering, this could be tailored to whatever language and alphabetic additions you like.
Here’s an example that calls the function with a few lines of typing practice (covering all the letters in the alphabet), where every 1 in 20 characters (at random) should be shifted. The result is put out to Scriptable’s console, but you could opt to pull in and update the clipboard for example.
console.log(gibberish(`The quick brown fox jumped over the lazy dog.
Jackdaws love my big sphinx of quartz.
How vexingly quick daft zebras jump.
Pack my box with five dozen liquor jugs.
The five boxing wizards jump quickly.`, 20));
Maybe that is something like what you were after?