python-2.7 – 如何在wit.ai中为内置实体添加值,如’wit $location’

python-2.7 – 如何在wit.ai中为内置实体添加值,如’wit $location’,第1张

概述我尝试过使用API​​服务: response = requests.post('https://api.wit.ai/entities/wit$location/values?v=20160526', headers={'Authorization':'Bearer xxx'}, data=j 我尝试过使用API​​服务:

response = requests.post('https://API.wit.ai/entitIEs/wit$location/values?v=20160526',headers={'Authorization':'Bearer xxx'},data=Json.dumps({ "value":"London","Expressions":["London"],"Metadata":"CITY_1234"}))

但我得到的回应是:

{'code': 'not-found','error': "Entity '535a80ff-6399-4653-8b2a-c770dd014965' not found"}

我很确定名为wit $location的实体存在.

response = requests.get('https://API.wit.ai/entitIEs/wit$location?v=20160526',headers={'Authorization':'Bearer xxx'})

响应是:

{'builtin': True,'doc': '{"spanless":false,"short_desc":"specific position or '        'address","long_desc":"Capture free text that\'s a typical location,'        'place or address like `350 CambrIDge Ave Palo Alto`,`925 Alma '        'Street`,`SFO`,and `Sausalito,CA`.\nUse wit/local_search_query for '        'local place like `my flower shopt` and '        '`Peet\'s`","examples":[{"Expression":["meet me at","350 CambrIDge Ave '        'Palo Alto","at noon"],"response":"\"entitIEs\" : {\n      '        '\"location\" : [ {\n        \"value\" : \"350 CambrIDge Ave '        'Palo Alto\"\n      } ]\n    '        '}","$$hashKey":"070"},{"Expression":["go to","925 Alma '        'street",""],"response":"\"entitIEs\" : {\n      \"location\" : [ '        '{\n        \"value\" : \"925 Alma street\"\n      } ]\n    '        '}","$$hashKey":"07Z"},{"Expression":["i need a rIDe to","Sausalito,'        'CA","response":"\"entitIEs\" : {\n      \"location\" : [ '        '{\n        \"value\" : \"Sausalito,CA\"\n      } ]\n    '        '}","$$hashKey":"081"},{"Expression":["I came '        'from","SFO","?"],"response":"\"entitIEs\" : {\n      '        '\"location\" : [ {\n        \"value\" : \"SFO\"\n      } '        ']\n    '        '}","$$hashKey":"083"}],"similar_wisps":[{"name":"wit/local_search_query","$$hashKey":"072"}]}','exotic': False,'ID': '535a80ff-6399-4653-8b2a-c770dd014965','lang': 'en','lookups': ['free-text'],'name': 'location','values': []}

我希望能够为$location实体添加值.

解决方法 据我所知,您无法编辑/添加到内置实体.原因是,您可能希望在星球大战中或在您不起眼的区域添加所有城市,但其他人不希望让它们d出.

我的工作是添加一个名为“my_city”的实体,并将您特别想要识别的城市添加到该实体.在您的代码中,您只需在检查位置时检查两个实体中的一个…

希望这有帮助,祝你好运!

总结

以上是内存溢出为你收集整理的python-2.7 – 如何在wit.ai中为内置实体添加值,如’wit $location’全部内容,希望文章能够帮你解决python-2.7 – 如何在wit.ai中为内置实体添加值,如’wit $location’所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1196336.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存