Language sentiment analysis and neural networks... for trolls.
Troll is a tool for performing sentiment analysis (ie: "is this naughty or nice") on arbitrary blocks of text and associating it with a unique user. Using this data, combined with a rather naïve neural network and some training data, users can be indentified as "trolls".
Troll uses Redis for data storage. Once Redis is up and running, you can install Troll using NPM:
npm install troll
var troll = ;troll;troll;
Before attempting to classify a user, you'll need to train Troll. You can specify your own training data or use a basic set that is included. To load the included training set:
Once trained, now you can classify:
The value returned for the
troll key represents the probability of that user being a troll. In other words, a value of
0 would likely represent a particularly friendly user, while a value of
1 would be... uh, Ted Dziuba?
The underlying sentiment analysis module supports "injecting" additional key/value pairs. This is useful in certain situations where you may want to exclude or even blacklist certain words based on a particular use case. For example:
Troll uses your environment by looking at
process.env for connection settings. If none are found, default Redis connection settings are used:
TROLL_HOST: nullTROLL_PORT: nullTROLL_PASS: null