Skip to main content

Toxic Spans Prediction

Project description

License PyPI version Downloads

HateSpans

We provide state-of-the-art models to detect toxic spans in text. We have evaluated our models on Toxic Spanstask at SemEval 2021 (Task 5).

Installation

You first need to install PyTorch. The recommended PyTorch version is 1.6. Please refer to PyTorch installation page regarding the specific install command for your platform.

When PyTorch has been installed, you can install HateSpans from pip.

From pip

pip install hatespans

Pretrained HateSpans Models

We will be keep releasing new models. Please keep in touch. We have evaluated the models on the trial set released for Toxic Spanstask at SemEval 2021.

Models Average F1
en-base 0.6734
en-large 0.6886
multilingual-base 0.5953
multilingual-large 0.6013

Prediction

Following code can be used to predict toxic spans in text. Upon executing, it will download the relevant model and return the toxic spans.

from hatespans.app.hate_spans_app import HateSpansApp

app = HateSpansApp("en-base", use_cuda=False)
print(app.predict_hate_spans("You motherfucking cunt", spans=True))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hatespans-0.2.0.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

hatespans-0.2.0-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file hatespans-0.2.0.tar.gz.

File metadata

  • Download URL: hatespans-0.2.0.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for hatespans-0.2.0.tar.gz
Algorithm Hash digest
SHA256 534f5dfa762d0ca9702a89e310f2bf1e1d621c8ada611c63d80092f79eb8bb52
MD5 cd92e4087c2c94b95a41576d30e13ea6
BLAKE2b-256 c0b86c4f05faa32772652cb2f4328abfc38ace4f2cc58b8bf2c6c3924eb0b3d1

See more details on using hashes here.

File details

Details for the file hatespans-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: hatespans-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for hatespans-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89d65e91150f9e8ba6065ac748056a93024fa7ff248e08eba1a773559a6bc061
MD5 4c46dfd680cdeeb9ea433e73e9778862
BLAKE2b-256 1fb3eed4ab129c4289e3f351ce26df9df9a04f72f4c76a5d9522dba3c965ad6b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page