【问题标题】:Get notable_type from Freebase Search output从 Freebase 搜索输出中获取 notable_type
【发布时间】:2014-10-26 20:51:38
【问题描述】:

我正在尝试从搜索结果中获取值得注意的类型,例如,当我搜索“氦”时,我可以将“氦(化学元素)”和“氦(艺术家)”显示为两个选项在搜索返回多个具有相同显示名称的事物时进行选择。

现在,我可以像这样获得原始类型:

service_url = 'https://www.googleapis.com/freebase/v1/search'    
params = {
    'query': query,
    'key': FREEBASE_KEY,
    'output': '(topic)'
}
url = service_url + '?' + urllib.urlencode(params)
for result in response['result']:
    print result['output']['type']['/type/object/type'][0]['name']

但这经常给我一种不是我真正想要的类型,或者仍然很模棱两可/奇怪的东西。所以我想获得 Notable Type 或 Notable For 而不仅仅是原始类型。

因此,当我在'output' 参数中将type 替换为notable_type/common/notable_for/display_name/common/topic/notable_for/ 时,我收到一个错误,因为我的搜索没有结果。

那么,我怎样才能使用输出获得 Notable Type?

非常感谢。

【问题讨论】:

    标签: python freebase


    【解决方案1】:

    正确的输出参数是:

    'output': '(notable)'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-22
      • 1970-01-01
      相关资源
      最近更新 更多