Last updated: Jul 25, 2024
The Watson Natural Language Processing HAP detection identifies hateful, abusive, and profane content (HAP
content) in texts.
Block name
classification_transformer_en_slate.38m.hap
Supported languages
The HAP Detection block is able to detect HAP in English texts only.
Capabilities
Use this block to detect hateful, abusive or profane content in texts.
Dependencies on other blocks
None
Code sample
import watson_nlp
# Load the HAP model
hap_model = watson_nlp.load('classification_transformer_en_slate.38m.hap')
# Run the HAP model and print the result
hap_prediction = hap_model.run('Spiders are disgusting.')
print(hap_prediction)
Output of the code sample
{
"classes": [
{
"class_name": "has_HAP",
"confidence": 0.9629989862442017
},
{
"class_name": "no_HAP",
"confidence": 0.03700101003050804
}
],
"producer_id": {
"name": "Transformer-based Text Classifier",
"version": "0.0.1"
}
}
Parent topic: Watson Natural Language Processing task catalog