2017-02-03 4 views
0

「エッフェル塔の高さはどうですか?」といった質問は可能ですか? Googleの知識グラフAPIを使用して?そうでない場合、正しいapiは何ですか?google knowledge graph apiを使用して自由形式の質問をすることは可能ですか?

私はこの試してみてください。私が取得し、空の結果

https://kgsearch.googleapis.com/v1/entities:search?query=how+tall+is+eiffel+tower&key=my_key&limit=1&indent=True

を。

+0

https://developers.google.com/knowledge-graph/には多くの例はありませんが、フリーテキストでエンティティを検索するのではなく、名前でエンティティを検索するためのものと思われます。 –

答えて

1

尋ねることは可能ですが、時間の半分はあなたが求めていたものとは異なるもので「答えます」残りの時間は空の結果が得られます。

曖昧さがない検索でも、通常は空の結果または予期しない結果が返されます。たとえば、現在の米国大統領を検索すると、バラク・オバマに関する結果が返されます。私は米国人の人口を検索すると、実際に何を言わなければならないのでしょうか(318.9百万人(0120)2015)

=> #<HTTParty::Response:0x7ffc5857b938 parsed_response={"@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/09c7w0", "name"=>"United States", "@type"=>["Country", "Thing", "Place", "AdministrativeArea"], "description"=>"Country", "image"=>{"contentUrl"=>"http://t1.gstatic.com/images?q=tbn:ANd9GcQKp8mjZhEK0hZroCA4srP9VA9eD8-0PcCsKSU4olhQlh6dMlxc", "url"=>"https://commons.wikimedia.org/wiki/File:USA_Flag_Map.svg", "license"=>"http://creativecommons.org/licenses/by-sa/2.5"}, "detailedDescription"=>{"articleBody"=>"The United States of America, commonly referred to as the United States or America, is a federal republic composed of 50 states, a federal district, five major self-governing territories, and various possessions. ", "url"=>"https://en.wikipedia.org/wiki/United_States", "license"=>"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"}, "url"=>"http://www.usa.gov/"}, "resultScore"=>246.96698}, {"@type"=>"EntitySearchResult", "result"=>{"@id"=>"kg:/g/1q5jrvck9", "name"=>"Population: Us", "@type"=>["Thing"], "description"=>"Song by Frank Portman"}, "resultScore"=>20.875225}]}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"content-type"=>["application/json; charset=UTF-8"], "vary"=>["Origin", "X-Origin", "Referer"], "date"=>["Fri, 03 Feb 2017 20:33:38 GMT"], "server"=>["ESF"], "cache-control"=>["private"], "x-xss-protection"=>["1; mode=block"], "x-frame-options"=>["SAMEORIGIN"], "x-content-type-options"=>["nosniff"], "alt-svc"=>["quic=\":443\"; ma=2592000; v=\"35,34\""], "connection"=>["close"], "transfer-encoding"=>["chunked"]}> 

私がどのようにフレーズを使用しているのか、どのキーワードを使用しているのかに関わらず、それは事実上役に立たない。私はまた、私が望む結果の&types=を指定しようとしました。まれに予期した結果を返すことはほとんどありません。私はアメリカの米国を検索するときに、たとえば:

=> #<HTTParty::Response:0x7ffc58619f20 parsed_response={"@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/09c7w0", "name"=>"United States", "@type"=>["Country", "Thing", "Place", "AdministrativeArea"], "description"=>"Country", "image"=>{"contentUrl"=>"http://t1.gstatic.com/images?q=tbn:ANd9GcQKp8mjZhEK0hZroCA4srP9VA9eD8-0PcCsKSU4olhQlh6dMlxc", "url"=>"https://commons.wikimedia.org/wiki/File:USA_Flag_Map.svg", "license"=>"http://creativecommons.org/licenses/by-sa/2.5"}, "detailedDescription"=>{"articleBody"=>"The United States of America, commonly referred to as the United States or America, is a federal republic composed of 50 states, a federal district, five major self-governing territories, and various possessions. ", "url"=>"https://en.wikipedia.org/wiki/United_States", "license"=>"https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"}, "url"=>"http://www.usa.gov/"}, "resultScore"=>4238.782227}]}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"content-type"=>["application/json; charset=UTF-8"], "vary"=>["Origin", "X-Origin", "Referer"], "date"=>["Fri, 03 Feb 2017 20:29:07 GMT"], "server"=>["ESF"], "cache-control"=>["private"], "x-xss-protection"=>["1; mode=block"], "x-frame-options"=>["SAMEORIGIN"], "x-content-type-options"=>["nosniff"], "alt-svc"=>["quic=\":443\"; ma=2592000; v=\"35,34\""], "connection"=>["close"], "transfer-encoding"=>["chunked"]}> 

私はすでに行ったようにそれをあなたの時間を無駄にしないようお勧めします。 Custom Search APIにはナレッジグラフの結果が含まれておらず、「非カスタム」検索APIは長らくdeprecatedでした。

関連する問題