GithubHelp home page GithubHelp logo

twss.js's Introduction

This is a node.js module that classifies if a sentence can be replied with "that's what she said".

Installation

npm install twss

Usage

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

Settings

twss.algo

You change algorithm from the default naive bayes classifier (nbc) to a k-nearest neighbor algorithm (knn).

twss.algo = 'nbc';
twss.algo = 'knn';

twss.threshold

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

Additional functions

twss.probability

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 function.

twss.probability("Behold, I come quickly."); // 0.956323045469951

Or just use the alias twss.prob

twss.prob("The juice keeps coming out of the wrong hole!") // 0.9961630818418142

twss.js's People

Contributors

danielrapp avatar floby avatar twolfson avatar karbassi avatar thomwiggers avatar

Stargazers

 avatar  avatar Murilo Santana avatar Craig Edwards (Brain) avatar Mateus Antonio Franceschina avatar Death Seak avatar Alen Yohannan avatar Amogh Umesh avatar  avatar Richard avatar Rampey avatar Kevin Liyanto avatar Tal Abziz avatar Kevin Liyanto avatar Milan Xavier avatar Anirudh Dagar avatar Chirag Bapat avatar Karthik Ambu avatar Tyler Sommer avatar Akanksh A Manjunath avatar Aditya Prerepa avatar [] avatar nodojo avatar Mohammad Amaan avatar Ryan Underwood avatar JC avatar Dez avatar Jose Manuel Viloria avatar DAVID RUPP JR. avatar MÓZES Ádám István avatar  avatar Ish Ot Jr. avatar Anshuman Suri avatar Eric Pigeon avatar issue哥 avatar Dmitry avatar Jakub Miziołek avatar Mathias Hoffmann avatar Karan Sharma avatar Adrian von Gegerfelt avatar  avatar  avatar Andrew Dassonville avatar jmz avatar Vivek Kumar avatar  avatar John-Henry Liberty avatar Varun Dey avatar Sayan Das avatar Kostas Stamatiadis avatar Ivaylo Stoyanov avatar Nicolaas Wagenaar avatar Jonathan Kim avatar Ben avatar Tom Sutton avatar Zack Smith avatar Angus H. avatar Mike Diarmid avatar rfong avatar Mark Steve Samson avatar Tej Qu Nair avatar Grzegorz Rozdzialik avatar Patrik Holčák avatar Jon Paul Uritis avatar Ved Topkar avatar  avatar Nemanja avatar Sean Yalda avatar  avatar JT5D avatar Eric Connelly avatar  avatar Glavin Wiechert avatar Dan Bennett avatar Simon Kusterer avatar Yaniv Kessler avatar Thomas H. avatar Arjen Oosterkamp avatar Johan van Zonneveld avatar Nathan H. Leung avatar  avatar Petr Brzek avatar Koen Punt avatar Doğan Derya avatar Rhythm avatar  avatar MB avatar Neil Carpenter avatar Josh Kingsley avatar Conner DiPaolo avatar steven jacobs avatar Joseph Werle avatar inconvergent avatar Angel Estrada avatar Vitaliy Berov avatar Tom Hallam avatar Michael Anthony avatar Nupur Kapoor avatar Nick Poorman avatar Sam Milledge avatar

Watchers

 avatar  avatar  avatar Michael Anthony avatar Marius avatar Helena Wu avatar  avatar Johannes Jansson avatar  avatar

twss.js's Issues

Short sentences biased

Short sentences trigger relentlessly. I.e. "oh wow lol", "oh god", "oh what", "oh why", "oh, right.", "always good", "no one does", "much better", "all my want", "god damn", "OH", "oh my", "I'm in awe", "i guess", "it isn't", "ok", "aint hard" and for some reason "I will never program in java"

CLI utility

adding the possibiliy to use twss in a terminal environment could be interesting and would be easier to integrate with other programs.
I'm willing to send a pull request if I can find some time to do it.

Add support for polling github issues

  • poll github issues
  • on new issue:
    • calculate twss-score
    • if score > limit, reply accordingly (cool message needed!)
  • see how long it takes to be banned

k-NN doesn't work at all

It just returns this error:

ReferenceError: trainingPrompt is not defined
    at Object.isTwss (/Users/Daniel/twss.js/lib/classifier/knn.js:35:7)
    at Object.is (/Users/Daniel/twss.js/lib/twss.js:49:33)
    at [object Context]:1:3
    at Interface.<anonymous> (repl.js:171:22)
    at Interface.emit (events.js:64:17)
    at Interface._onLine (readline.js:153:10)
    at Interface._line (readline.js:408:8)
    at Interface._ttyWrite (readline.js:585:14)
    at ReadStream.<anonymous> (readline.js:73:12)
    at ReadStream.emit (events.js:81:20)

Crowdsourcing site

This might be useful:

  • shows latest tweets with very high and very low score
  • users can click +/-
  • stuff with many votes into one direction and nearly none into the other comes into the rating DB

As it would also provide quite some entertainment, I guess you'd get enough users for this. :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.