About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Last updated: Jul 25, 2024
The Watson Natural Language Processing HAP detection identifies hateful, abusive, and profane content (
content) in texts.HAP
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