Toxic Triggers
Toxic Triggers is a Python package that provides access to a dataset of text triggers that have been categorized as offensive or harmless to minorities. This package can be useful for researchers and developers who want to understand how offensive language can affect marginalized groups and how it can be detected and prevented.
Features
- Access to a dataset of text triggers categorized as offensive or harmless to minorities
- Provides easy access to subsets of the dataset based on categorization
- Built with Pandas for easy data manipulation
- Analyze the text for the presence of toxic triggers
Installation
To install the package, you can use pip install toxicTrig
Usage
Here's an example of how to use the package:
from toxicTrig import toxicTrig
import pandas as pd #type: ignore
import time
df = pd.read_csv("example_data/ND_founta_trn_dial_pAPI.csv")
text = df["tweet"].tolist() # A list of strings as the input
tt = toxicTrig()
start_time = time.time()
tt.text_analysis(text, batch_size=100)
end_time = time.time()
time_taken = round(end_time - start_time, 2)
print("Total time taken: ", time_taken, " seconds")
# Count tokens in text
total_tokens = sum([len(t.split()) for t in text])
print("Total tokens in text: ", total_tokens)
Contribution
Install dev options
pip install -e ".[dev]"
mypy --install-types --non-interactive toxicTrig
pip install pre-commit
pre-commit install
New branch for each feature
git checkout -b feature/feature-name and PR to main branch.
Before committing
Run pytest to make sure all tests pass (this will ensure dynamic typing passed with beartype) and mypy --strict . to check static typing.
(You can also run pre-commit run --all-files to run all checks)
Citation
If you use this package in your research, please cite the following paper:
@inproceedings{zhou-etal-2020-debiasing,
title = {Challenges in Automated Debiasing for Toxic Language Detection},
author = {Zhou, Xuhui and Sap, Maarten and Swayamdipta, Swabha and Choi, Yejin and Smith, Noah A.},
booktitle = {EACL},
year = {2021},
}
License
This package is released under the MIT License. See the LICENSE file for more details.
Credits
This package was developed by Xuhui Zhou and Maarten Sap.
Metadata
Release files for toxicTrig 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| toxicTrig-0.3.0.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| toxicTrig-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / toxicTrig-0.3.0.tar.gz
| Download URL | toxicTrig-0.3.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7bfb688e8f31fa50405756f684bde974906332d00b487992ee53356d653389c
|
|
BLAKE2b-256 checksum How to use checksums |
b15f7a703c2746e2644ed4fb26787aa0c46e39493a5a634579290bc39b3c5db4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / toxicTrig-0.3.0-py3-none-any.whl
| Download URL | toxicTrig-0.3.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea2f50e8669e4191f26c07eeb2064682bd34683ef826d1afa60bf54fd10f960c
|
|
BLAKE2b-256 checksum How to use checksums |
d9fb973e90f3e338cd308615cd0cefeabee1283e80250cdecb7cabdc550dc44d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|