美文网首页
腾讯文智api

腾讯文智api

作者: Jlan | 来源:发表于2018-07-19 17:18 被阅读13次
    from QcloudApi.qcloudapi import QcloudApi
    import json
    
    
    config = {
        "Region": "sh",
        "secretId": "",
        "secretKey": "",
        "method": "get"
    }
    
    
    def request(params):
        try:
            service = QcloudApi(module, config)
            print(service.generateUrl(action, params))
            s = service.call(action, params)
            dejson = json.loads(s)
            print(dejson)
        except Exception as e:
            print("exception:", e)
    
    
    if __name__ == "__main__":
        module = 'wenzhi'
        action = "LexicalAnalysis"
        # action = 'LexicalSynonym'
        # action = 'TextKeywords'
    
        params = {
            "text": "紫金山在哪里,是在南京吗",
            "code": 0x00200000,
            "type": 0
        }
    
        request(params)
    

    相关文章

      网友评论

          本文标题:腾讯文智api

          本文链接:https://www.haomeiwen.com/subject/sgntmftx.html