humanization
is a library that seeks to simulate human patterns of mistakes when typing text. It can serve as a kind of ergonomic layer for automated chatbots to make them feel more human.
import { humanize } from "humanization";
humanize("All their equipment and instruments are alive.");
// => "Alllllllllll their eequIpmeNT anD instuments re alivve."
humanize("Thanks so much!", {
repetition: {
probability: 0.1,
type: "WORD"
},
// Implementing a custom "thanks" applicator
thanks: {
probability: 1.0,
type: "WORD",
apply: word => (word.toLowerCase() === "thanks" ? "thx" : word)
}
});
// => "thx sooooooo much!"
yarn install
yarn watch
yarn test
oryarn test --watch
yarn compile