文档中心 > API类目 > 内容平台API

alibaba.nlp.review.analysis.ecommerce (分析句子情感)

分析句子情感,目前有两个功能: 1 句子情感倾向性,电商领域; 2 属性级别情感分析,支持行业:服装

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
text String 必须 面料舒适,款式好,只是尺码偏小,好在我看了其他买家的评价,在原尺码上加了一号,正合适,很满意!给满分!服务好,发货快! 要处理的文本

响应参数

名称 类型 示例值 描述
aspect_item_list AspectItem [] 属性情感列表,每个元素是一个json字段
  • └ aspect_polarity
  • String
  • 属性片段极性(正、中、负)
  • └ aspect_term
  • String
  • 发货
  • 属性词
  • └ aspect_category
  • String
  • 物流
  • 属性类别
  • └ opinion_term
  • String
  • 发货快
  • 情感词
  • └ aspect_index
  • String
  • 55 57
  • 属性词所在的起始位置,终结位置
text_polarity String 1 整条文本情感极性(正面:1,中性:0,负面:-1,text字段输入非法:-100)
ret_code String 10015 错误码
ret_msg String request invalid, missing tenant id 详细错误信息

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaNlpReviewAnalysisEcommerceRequest req = new AlibabaNlpReviewAnalysisEcommerceRequest();
req.setText("面料舒适,款式好,只是尺码偏小,好在我看了其他买家的评价,在原尺码上加了一号,正合适,很满意!给满分!服务好,发货快!");
AlibabaNlpReviewAnalysisEcommerceResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<alibaba_nlp_review_analysis_ecommerce_response>
    <aspect_item_list>
        <aspect_item>
            <aspect_polarity>中</aspect_polarity>
            <aspect_term>发货</aspect_term>
            <aspect_category>物流</aspect_category>
            <opinion_term>发货快</opinion_term>
            <aspect_index>55 57</aspect_index>
        </aspect_item>
    </aspect_item_list>
    <text_polarity>1</text_polarity>
    <ret_code>10015</ret_code>
    <ret_msg>request invalid, missing tenant id</ret_msg>
</alibaba_nlp_review_analysis_ecommerce_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部