0
如何使用python獲得使用freebase名稱的查詢中的別名列表?Freebase查詢使用python獲取別名
例如,下面的查詢
[{
"name": "citigroup",
"/common/topic/alias": []
}]
給
{
"result": [
{
"/common/topic/alias": [
"Citigroup Inc.",
"TRAVELERS GROUP INC",
"CITIGROUP INC",
"TRAVELERS INC",
"Citi"
],
"name": "Citigroup"
},
{
"/common/topic/alias": [],
"name": "Citigroup"
}
]
}
我想要的清單
["Citigroup Inc.",
"TRAVELERS GROUP INC",
"CITIGROUP INC",
"TRAVELERS INC",
"Citi"]
我
service_url = 'https://www.googleapis.com/freebase/v1/search'
query = { "name": "citigroup", "/common/topic/alias": []}
params = [{ 'query': json.dumps(query), 'key': key, 'limit':5}]
url = service_url + '?' + urllib.urlencode(params)
response = json.loads(urllib.urlopen(url).read())
嘗試10
但是,響應不會產生任何東西......任何幫助將不勝感激!由於
嘗試將服務網址更改爲「https://www.googleapis.com/freebase/v1/mqlread」 – Gunjan 2014-12-11 06:12:29