python - 访问 IBM Watson nl-classifier 中的置信度参数

标签 python nlp ibm-cloud classification ibm-watson

我正在构建一个网络应用程序,当我输入网页时,它将获取网页的文本内容,对其进行标记并将每一行提供给经过训练的分类器,我想要的是对那些行进行一些处理置信度参数 > 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 使用 andor 作为逻辑运算条件。 将检查这两个条件是否为true。如果是的话就做点什么。

关于python - 访问 IBM Watson nl-classifier 中的置信度参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43695139/

相关文章:

python - 为 Pandas DataFrame 中的每个类别创建列

python - 我如何使用 colorchecker 在 opencv 中进行颜色校准?

nlp - 如何将地名词典或词典表示为 crf++ 中的特征?

ibm-cloud - 在 Cloudant 中轮询更改源时,我是否可以获得所有修订?

python - 如何以编程方式检测文件是否为 Python 脚本

python - 如何用互斥量装饰 Python 对象

regex - 将多段文档拆分为段落编号的句子

machine-learning - 最新的句子可读性算法

ant - 运行 Ant 脚本以在 Bluemix 中准备数据库

java - bluemix 上支持 http posts 的 Web 服务