【问题标题】:How to use multiple targets in AlchemyAPI targeted sentiment analysis?如何在 AlchemyAPI 定向情感分析中使用多个目标?
【发布时间】:2016-01-11 23:02:05
【问题描述】:

使用 AlchemyAPI 语言进行有针对性的情绪分析时,docs 表示您可以指定targettargets。指定 targets 会导致响应包含一个数组,但是我不知道如何在一次调用中指定多个目标。

指定单个目标(但使用targets 参数):

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "text=I love cats. Dogs are the worst." -d "targets=cats" -d "outputMode=json" "https://gateway-a.watsonplatform.net/calls/text/TextGetTargetedSentiment?apikey=MY_API_KEY"

服务是否支持多个目标?如果是这样,我该如何通过它们?

【问题讨论】:

    标签: alchemyapi


    【解决方案1】:

    文档已更新,答案是:http://www.alchemyapi.com/api/sentiment/textc.html#targetedsentiment

    解决方案是使用竖线字符:dogs|cats。

    完整示例:

    curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "text=I love cats. Dogs are the worst." -d "targets=cats|dogs"  -d "outputMode=json"    "https://gateway-a.watsonplatform.net/calls/text/TextGetTargetedSentiment?apikey=MY_API_KEY"
    

    【讨论】:

      猜你喜欢
      • 2014-10-08
      • 2016-07-25
      • 2015-02-12
      • 2016-02-14
      • 2016-03-21
      • 2023-02-16
      • 2022-01-15
      • 2016-04-03
      • 1970-01-01
      相关资源
      最近更新 更多