语义相似度技术 error
cecil_wang 发布于2018-06 浏览:1765 回复:5
0
收藏

为什么不能给出完整的一个例子呢?这点应该学学百度地图。

请问错在什么地方?还能不能治疗?

 

python 3.5.2

import requests

收藏
点赞
0
个赞
共5条回复 最后由轩尚装修回复于2020-05
#6轩尚装修回复于2020-05

我也是这样的错误,我无语了。

0
#5CristinaoCong回复于2018-08
#2 cecil_wang回复
贴出源码,方便调试。 import requests # client_id 为官网获取的AK, client_secret 为官网获取的SK url = 'https://aip.baidubce.com/oauth/2.0/token' data = {'grant_type':'client_credentials','client_id':'XXXXXX',\ 'client_secret':'XXXXXX'} response = requests.post(url,data=data) content = response.content content = eval(content) access_token = content['access_token'] request_url = "https://aip.baidubce.com/rpc/2.0/nlp/v2/word_emb_sim&access_token"+access_token headers = {'Content-Type':'application/json'} data = {"word_1":"政务","word_2":"专利"} response = requests.post(request_url,data=data,headers=headers) content = eval(response.content) print(content)
展开

大哥,你的源码确实写错了啊,url 那里, "access_token"前面应该是"?"吧,你写的"&"

0
#4CristinaoCong回复于2018-08
#3 cecil_wang回复
对于百度的AI,我是服气的, 我觉得百度应该把我招进去,好好提升下NLP技术。 [图片]
展开

哈哈,确实服气

0
#3cecil_wang回复于2018-06

对于百度的AI,我是服气的,

我觉得百度应该把我招进去,好好提升下NLP技术。

0
#2cecil_wang回复于2018-06

贴出源码,方便调试。

import requests

# client_id 为官网获取的AK, client_secret 为官网获取的SK
url = 'https://aip.baidubce.com/oauth/2.0/token'
data = {'grant_type':'client_credentials','client_id':'XXXXXX',\
'client_secret':'XXXXXX'}

response = requests.post(url,data=data)
content = response.content
content = eval(content)
access_token = content['access_token']

request_url = "https://aip.baidubce.com/rpc/2.0/nlp/v2/word_emb_sim&access_token"+access_token

headers = {'Content-Type':'application/json'}

data = {"word_1":"政务","word_2":"专利"}

response = requests.post(request_url,data=data,headers=headers)

content = eval(response.content)

print(content)

0
TOP
切换版块