我正在构建一个网络应用程序,当我输入网页时,它将获取网页的文本内容,对其进行标记并将每一行提供给经过训练的分类器,我想要的是对那些行进行一些处理置信度参数 > 0.98。以下是来自 bluemix 网站的示例:
{
"classifier_id": "10D41B-nlc-1",
"url": "https://gateway.watsonplatform.net/natural-language-classifier /api/v1/classifiers/10D41B-nlc-1/classify?text=How%20hot%20wil/10D41B-nlc-1",
"text": "How hot will it be today?",
"top_class": "temperature",
"classes": [
{
"class_name": "temperature",
"confidence": 0.9998201258549781
},
{
"class_name": "conditions",
"confidence": 0.00017987414502176904
}
]
}
现在在上面的示例中,我想要一些 class_name: 温度置信度 > 0.95 的内容。
#if class.temperature.confidence > 0.98
#do something with it
可能吗?
最佳答案
通过应用程序 NLP 返回的 JSON,您可以在同一个 if
中加入两个条件 true
来执行此操作。
在这种情况下:
if classes.classes_name === 'temperature' and classes.confidence > 0.95
//do something
Python 使用 and
和 or
作为逻辑运算条件。 和
将检查这两个条件是否为true
。如果是的话就做点什么。
关于python - 访问 IBM Watson nl-classifier 中的置信度参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43695139/