Skip to content

Instantly share code, notes, and snippets.

@weisjohn
Forked from mutewinter/twss.coffee
Last active December 17, 2015 09:59
Show Gist options
  • Save weisjohn/5591159 to your computer and use it in GitHub Desktop.
Save weisjohn/5591159 to your computer and use it in GitHub Desktop.
That's what see said hubot script.
# Description:
# Use Skynet to determine if a thing that was said is actually something
# S.H.E (Silicon Helix Entity) said.
#
# Dependencies:
# "twss": "0.1.6"
#
# Commands:
# Just say something like, "that was hard". Hubot will do the rest.
#
# Author:
# Jeremy Mack (mutewinter)
#
# Revised:
# John Weis (weisjohn)
TWSS_THRESHOLD = 0.9
twss = require('twss')
twss.threshold = TWSS_THRESHOLD
module.exports = (robot) ->
robot.hear /(.*)/i, (msg) ->
message = msg.match[1]
probability = twss.probability(message)
if probability > 0.9
msg.send "That's what she said."
console.log "Innuendo Probability for #{message} #{(probability * 100)/100}%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment