Skip to main content

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))

Metadata

Release files for hatespans 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hatespans 0.2.0
File Size Uploaded Provenance Actions
hatespans-0.2.0.tar.gz 42.6 kB Without provenance Details for hatespans-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hatespans 0.2.0
File Interpreter ABI Platform Actions
hatespans-0.2.0-py3-none-any.whl Python 3 none any Details for hatespans-0.2.0-py3-none-any.whl

Total release size: 92.5 kB

Release files / hatespans-0.2.0.tar.gz

Download URL hatespans-0.2.0.tar.gz
Size 42.6 kB
Tags Source
SHA-256 checksum
How to use checksums
534f5dfa762d0ca9702a89e310f2bf1e1d621c8ada611c63d80092f79eb8bb52
BLAKE2b-256 checksum
How to use checksums
c0b86c4f05faa32772652cb2f4328abfc38ace4f2cc58b8bf2c6c3924eb0b3d1
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / hatespans-0.2.0-py3-none-any.whl

Download URL hatespans-0.2.0-py3-none-any.whl
Size 49.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89d65e91150f9e8ba6065ac748056a93024fa7ff248e08eba1a773559a6bc061
BLAKE2b-256 checksum
How to use checksums
1fb3eed4ab129c4289e3f351ce26df9df9a04f72f4c76a5d9522dba3c965ad6b
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for hatespans 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page