{"id":13747031,"url":"https://github.com/thisandagain/troll","last_synced_at":"2025-04-09T07:10:02.509Z","repository":{"id":4893959,"uuid":"6049521","full_name":"thisandagain/troll","owner":"thisandagain","description":"Language sentiment analysis and neural networks... for trolls.","archived":false,"fork":false,"pushed_at":"2013-01-18T19:46:49.000Z","size":133,"stargazers_count":333,"open_issues_count":0,"forks_count":14,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-04-04T12:08:32.206Z","etag":null,"topics":["javascript","moderation","neural-network","nlp","sentiment","sentiment-analysis"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"nextrevision/docker-registry-ui","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thisandagain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-02T18:40:40.000Z","updated_at":"2025-03-27T18:54:41.000Z","dependencies_parsed_at":"2022-08-06T18:00:42.470Z","dependency_job_id":null,"html_url":"https://github.com/thisandagain/troll","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisandagain%2Ftroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisandagain%2Ftroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisandagain%2Ftroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisandagain%2Ftroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thisandagain","download_url":"https://codeload.github.com/thisandagain/troll/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994122,"owners_count":21030050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","moderation","neural-network","nlp","sentiment","sentiment-analysis"],"created_at":"2024-08-03T06:01:11.786Z","updated_at":"2025-04-09T07:10:02.483Z","avatar_url":"https://github.com/thisandagain.png","language":"JavaScript","readme":"## troll\n#### Language sentiment analysis and neural networks... for trolls.\n\n[![Build Status](https://secure.travis-ci.org/thisandagain/troll.png)](http://travis-ci.org/thisandagain/troll)\n\nTroll 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\".\n\n### Installation\nTroll uses [Redis](http://redis.io/) for data storage. Once Redis is up and running, you can install Troll using NPM:\n```bash\nnpm install troll\n```\n\n### String Analysis\n```javascript\nvar troll   = require('troll');\n\ntroll.analyze('This is totally awesome!', 'user123', function (err, result) {\n    console.log(result);    // 2.5\n});\n\ntroll.analyze('This is lame.', 'user456', function (err, result) {\n    console.log(result);    // -1.333\n});\n```\n\n### Training\nBefore 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:\n```javascript\ntroll.train(function (err, result) {\n    console.dir(result);    // { error: 0.0049931996067587685, iterations: 802 }\n});\n```\n\n### User Classification\nOnce trained, now you can classify:\n```javascript\ntroll.classify('user123', function (err, result) {\n    console.dir(result);    // { total: 9, sum: 36, troll: 0.010294962292857838 }\n});\n```\n\nThe 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?\n\n---\n\n### Modifing The Sentiment Engine\nThe underlying [sentiment analysis module](https://github.com/thisandagain/sentiment) 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:\n```javascript\ntroll.inject({\n    'stupid': -5,\n    'lame': -5\n});\n\ntroll.analyze('This is totally stupid and lame!', 'user123', function (err, result) {\n    console.log(result);    // -5.833\n});\n```\n\n### Redis Connection Options\nTroll uses your environment by looking at `process.env` for connection settings. If none are found, default [Redis](http://redis.io/) connection settings are used:\n```\nTROLL_HOST: null\nTROLL_PORT: null\nTROLL_PASS: null\n```\n\n---\n\n### Testing\n```bash\nnpm test\n```\n\n### Credits\n- Neural network by [Heather Arthur](https://github.com/harthur)\n- Training data inferred and subsequently condensed by scraping [Boing Boing's](http://boingboing.net) reader comments.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisandagain%2Ftroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthisandagain%2Ftroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisandagain%2Ftroll/lists"}