0 / 0
Go back to the English version of the documentation
仇恨、辱骂和亵渎内容检测
Last updated: 2024年7月29日
仇恨、辱骂和亵渎内容检测

这Watson自然语言处理 HAP 检测可识别仇恨、辱骂和亵渎内容(HAP文本中的“内容”

块名

classification_transformer_en_slate.38m.hap

受支持的语言

HAP 检测模块只能检测英文文本中的 HAP。

功能

使用此块来检测文本中的仇恨,辱骂或亵渎内容。

对其他块的依赖

代码样本

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)

代码示例的输出

{
  "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"
  }
}

父主题:Watson自然语言处理任务目录

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more