https://github.com/thundergolfer/insults
Detect whether a social media comment is insulting or derogatory
https://github.com/thundergolfer/insults
kaggle linear-model machine-learning natural-language-processing sklearn social-media
Last synced: 9 months ago
JSON representation
Detect whether a social media comment is insulting or derogatory
- Host: GitHub
- URL: https://github.com/thundergolfer/insults
- Owner: thundergolfer
- License: gpl-3.0
- Created: 2017-01-29T09:15:52.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-21T21:06:45.000Z (over 3 years ago)
- Last Synced: 2025-09-23T05:40:53.621Z (9 months ago)
- Topics: kaggle, linear-model, machine-learning, natural-language-processing, sklearn, social-media
- Language: Python
- Size: 14.4 MB
- Stars: 23
- Watchers: 4
- Forks: 5
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Insults [](https://travis-ci.com/thundergolfer/Insults) [](https://codeclimate.com/repos/58fb905df9bb6802870021a9/feed) [](https://codeclimate.com/repos/58fb905df9bb6802870021a9/feed)
**TLDR: This project is very similar in functionality and purpose to Google's recent [Perspective API](https://www.perspectiveapi.com/) project** 
-----
### Basic Usage
```python
>>> from insults import Insults
>>> comment = "You are a disgusting maggot of a person."
>>> Insults.load_model()
>>> Insults.rate_comment(comment)
```
`0.89`
```python
>>> comments = ["You called me a \"dickhead\", so I'll say you're a cunt.", "These shitakes taste like shit."]
>>> Insults.foul_language(comments, context=False)
```
`['cunt', 'shit'], None`
### Installation [Package]
**Note:** This package is compatible with *Python 2* only
`pip install insults`
### Installation [Development]
If you'd like to contribute and hack on this project, feel free to clone a development version of this repository locally:
`git clone git://github.com/thundergolfer/Insults.git`
Once you have a copy of the source, run the following scripts:
`./install_miniconda.sh`
`./install_local.sh`
A Conda virtual environment is created and everything needed should be now installed into it. To activate the environment, run:
`source ./run_in_environment.sh`
or alternatively you can run single commands in the environment with:
`./run_in_environment.sh `
##### Running The Tests
`python -m pytest tests/`
### Credit
* [Character-level Convolutional Networks for Text
Classification](https://arxiv.org/pdf/1509.01626.pdf), with simple implementation by [mhjabreel](https://github.com/mhjabreel/) over [here](https://github.com/mhjabreel/CharCnn_Keras/blob/master/char_cnn.py)
* [cbrew](https://github.com/cbrew) for their original data-science work in [Imperium's Kaggle Competition](https://www.kaggle.com/c/detecting-insults-in-social-commentary). Code in [cbrew/Insults](https://github.com/cbrew/Insults)