Google的知识图谱API返回什么作为鲜为人知的搜索查询的结果?

时间:2017-01-04 05:13:03

标签: search google-knowledge-graph

我们正在尝试将Google的知识图与我们的某个应用程序集成,我们发现知识图对于热门搜索结果非常有用,但对于未定义图表的鲜为人知的查询的结果感到好奇。

1 个答案:

答案 0 :(得分:1)

根据我最近的搜索/我的简短经验,大多数情况下Google的知识图谱API会返回空结果,即使使用完全相同的查询进行简单的Google搜索也会给我带来结果I&#39 ;我正在寻找。这就是我所说的空洞结果' (当我搜索2014丰田凯美瑞SE轮胎尺寸时),例如:

[16] pry(main)> response = HTTParty.get("https://kgsearch.googleapis.com/v1/entities:search?query=2014 Toyota Camry SE tire size&key=#{API_KEY}")
=> {"@context"=>
{"@vocab"=>"http://schema.org/",
"goog"=>"http://schema.googleapis.com/",
"EntitySearchResult"=>"goog:EntitySearchResult",
"detailedDescription"=>"goog:detailedDescription",
"kg"=>"http://g.co/kg"},
"@type"=>"ItemList",
"itemListElement"=>[]}

其他时候它会返回不准确的结果(不是我想要的)。在下面的示例中,我正在搜索有关2014丰田凯美瑞的信息,但所有结果都显示为我正在搜索与公司相关的信息

[4] pry(main)> response = HTTParty.get("https://kgsearch.googleapis.com/v1/entities:search?query=2014 toyota camry&key=#{API_KEY}")
=> {"@context"=>
  {"@vocab"=>"http://schema.org/",
   "goog"=>"http://schema.googleapis.com/",
   "EntitySearchResult"=>"goog:EntitySearchResult",
   "detailedDescription"=>"goog:detailedDescription",
   "resultScore"=>"goog:resultScore",
   "kg"=>"http://g.co/kg"},
 "@type"=>"ItemList",
 "itemListElement"=>
  [{"@type"=>"EntitySearchResult",
    "result"=>
     {"@id"=>"kg:/m/02qtntf",
      "name"=>"Toyota Kirloskar Motor",
      "@type"=>["Corporation", "Thing", "Organization"],
      "description"=>"Automotive industry company",
      "detailedDescription"=>
       {"articleBody"=>
         "Toyota Kirloskar Motor Pvt Ltd is a subsidiary of Toyota Motor Corporation of Japan, for the manufacture and sales of Toyota cars in India. It is currently the 4th largest car maker in India after Maruti Suzuki, Hyundai, and Mahindra.\n",
        "url"=>"https://en.wikipedia.org/wiki/Toyota_Kirloskar_Motor",
        "license"=>"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"},
      "url"=>"http://www.toyotabharat.com"}
...

即使我指定了类型(即。&types=Car),我还没有得到我想要的结果。

我不知道为什么会这样,但确实如此。