I wrote some code that encodes messages in the same way as OP, but I can't figure out how to decode it.
function empty (n) {
return Array.apply(null, Array(n));
}
function rand_word () {
let n, str = "";
if (Math.random() < .4) {
n = 2 + Math.random() * 2;
} else {
n = 4 + Math.random() * 8;
}
return String
.fromCharCode
.apply(null,
empty(Math.floor(n))
.map((_) =>
Math.floor(Math.random() * 27) + 96));
}
function encode () {
return empty(20)
.map((_) =>
(Math.random() < 0.01) ?
("'" + rand_word() + "'") :
rand_word())
.join(" ");
}