This is a node.js module that classifies if a sentence can be replied with "that's what she said".
npm install twss
var twss = require('twss'); twss.is("Nice weather we're having today"); // false twss.is("Can you make it harder?"); // true twss.is("You're not going fast enough!"); // true
twss.algo = 'nbc'; twss.algo = 'knn';
If you want more obscure jokes to be accepted, you can set the "probability the sentence can be replied with twss" threshold. Be aware that a too low threshold may result in a lot of false-positives, and a too high threshold may result in a lot of false-negatives.
twss.threshold = 0.5; twss.is("You're hardly my first."); // false twss.threshold = 0.3; twss.is("You're hardly my first."); // true
If you'd just like the probability that a sentence can be replied with "That's what she said" you can use the
twss.probability("Behold, I come quickly."); // 0.956323045469951
Or just use the alias
twss.prob("The juice keeps coming out of the wrong hole!") // 0.9961630818418142