Giter VIP home page Giter VIP 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 karbassi avatar

Stargazers

Alan Garcia avatar

Watchers

Alan Garcia avatar James Cloos avatar

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.