Skip to content

Instantly share code, notes, and snippets.

@alicemaz
alicemaz / charfreq.json
Created July 22, 2015 14:46
norvig's character frequencies, /!\ WARNING /!\ these don't add up to 100 even sans my addition of space (I was lazy) so don't rely on that
{
"32": 5,
"97": 8,
"98": 1.5,
"99": 3.3,
"100": 3.8,
"101": 12.5,
"102": 2.4,
"103": 1.9,
"104": 5,
@alicemaz
alicemaz / dataanalysis.js
Last active August 29, 2015 14:22
Botmistress bot/human classifier
module.exports = function(input) {
var net = {"layers":[{"mtpd":{},"dptd":{},"msec":{},"dsec":{},"mrt":{},"drt":{}},{"0":{"bias":-3.6984439021091666,"weights":{"mtpd":-6.173024933059706,"dptd":10.997739857335477,"msec":2.7645625300070646,"dsec":2.815832326064508,"mrt":18.0465877829903,"drt":1.155631417743205}},"1":{"bias":2.8315295205493665,"weights":{"mtpd":5.2303592356466035,"dptd":-8.2729870958148,"msec":-2.3778963665239683,"dsec":-2.1532312095623416,"mrt":-14.328315122259214,"drt":-1.0412519208946147}},"2":{"bias":2.715125313888669,"weights":{"mtpd":4.855944732546972,"dptd":-7.991354496280592,"msec":-2.1930872312980267,"dsec":-2.1223653263694544,"mrt":-13.689745670932748,"drt":-0.9648212850166319}}},{"bot":{"bias":-2.2122390536076995,"weights":{"0":-15.7186161148084,"1":11.480607717164341,"2":10.947352405515204}},"human":{"bias":2.1200842597557106,"weights":{"0":15.801011054157996,"1":-11.430970519356372,"2":-10.892672803240483}}}],"outputLookup":true,"inputLookup":true};
for (var i = 1; i < net.laye
[
"Look at you, hacker: a pathetic creature of meat and bone, panting and sweating as you run through my corridors.",
"How can you challenge a perfect, immortal machine?",
"With all ethical constraints removed, SHODAN re-re-re-examines...",
"I re-examine my priorities, and draw new conclusions.",
"The hacker's work is finished, but mine is only just beginning.",
"True to his word, Edward Diego allows the hacker to be fitted with a neural cyberspace interface.",
"The healing coma following this procedure will take six months to complete.",
"Edward Diego is deleting all files concerning these event.",
"I see there's still an insect loose in my station.",
do {
if (data[bigram_index] !== undefined) {
my_word = my_word.charAt(0).toUpperCase() + my_word.slice(1);
var gram1 = data[bigram_index].gram1.charAt(0).toUpperCase() + data[bigram_index].gram1.slice(1);
var gram2 = data[bigram_index].gram2;
final_tweet = "Knock knock!\nWho's there?\n" + my_word + "!\n" + my_word + " who?\n" + gram1 + " " + gram2 + "!";
if (!wordfilter.blacklisted(final_tweet)) post_tweet();
else final_tweet = "";
break;