skip to navigation
skip to content

Not Logged In

twss 0.1.7

TWSS: A Naive Bayes classifier that can identify double entendres.

Latest Version: 0.1.8

This is an implementation of a simple double entendre classifier in Python.

This currently uses a Naive Bayes classifier (the NLTK implementation) as a Python package. This was inspired by the bvandenvos Ruby TWSS project and uses the same data corpus.

This was built on the eve of Barcamp Mumbai 8 and presented during a session there.

Suggestions welcome. Do file bugs. Fork away. Send us pull requests.

Setup Instructions

$ virtualenv --no-site-packages --distribute venv
$ source venv/bin/activate
$ pip install -r requirements.txt

This creates a virtual environment for this project and install all the packages necessary for the project to work.

Demo

Once this is installed, you can take it out for a spin:

>>> from twss import TWSS
>>> twss = TWSS()
>>> twss("That was hard")
True
>>> twss("Hello world")
False

The first call can take a while- the module needs to train the classifier against the pre-installed training dataset.

Getting dirty

You can supply your own training data using positive and negative corpus files:

>>> twss = TWSS(positive_corpus_file=open('foo.txt'), negative_corpus_file=open('bar.txt'))

or directly, as a list of tuples:

>>> training_data = [
... ("Sentence 1", True),
... ("Sentence 2", False),
...
... ]
>>> twss = TWSS(training_data)

Roadmap

  • Making this pip-installable.
  • Writing a sample web app.
  • Writing a sample Twitter client.
 
File Type Py Version Uploaded on Size
twss-0.1.7.tar.gz (md5) Source 2013-09-11 165KB
  • Downloads (All Versions):
  • 9 downloads in the last day
  • 87 downloads in the last week
  • 667 downloads in the last month
  • Author: Aditya Sengupta
  • Home Page: https://github.com/sengupta/twss
  • License:
    DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                        Version 2, December 2004
    
     Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
    
     Everyone is permitted to copy and distribute verbatim or modified
     copies of this license document, and changing it is allowed as long
     as the name is changed.
    
                DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
       TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    
      0. You just DO WHAT THE FUCK YOU WANT TO.
  • Package Index Owner: sengupta
  • DOAP record: twss-0.1.7.xml