rouxpz / affect-bot

Bot project for Beyond Verification research group.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Affect Bot

Bot project for Beyond Verification research group.

TO ADD NEW WORDS TO CORPUS:

Run sorting.py in the terminal, which will generate a JSON file with every script or poem included in the "python" folder. This JSON will need to be run through a validator and adjusted manually to work properly. I recommend using this one.

There is also a file called sorting-sentences.py, which will add new sentences to the corpus-s.json document in case you want to use the Markov Chain option in the JavaScript file.

The JSON files will contain the text from the script in pieces (words or sentences, depending on which one you use); the associated affects; and, for corpus.json, the part of speech of the word.

THE WEB INTERFACE

There are two options for generating phrases: one using parts of speech, and one using Markov chains (via the RiTA library). The Markov chain option is commented out at the moment. The eventual intent is to combine the two in some way.

New sentence constructions can be added in the js/bot.js file by adding to the constructions array. This should take the form of an array containing the parts of speech you want your sentence to follow, in order. I am using the UPenn tag set, default with NLTK, which is detailed here pretty nicely.

The bot is set to auto refresh the generated phrases every 5 seconds. This can be changed in the switchAffect() function in js/bot.js, as a parameter within setInterval(). If the page is refreshed, the entire history will be cleared; there is no database (everything is done client side at the moment).

About

Bot project for Beyond Verification research group.


Languages

Language:JavaScript 45.4%Language:Python 33.4%Language:CSS 11.5%Language:HTML 9.7%