私は練習用にphpで小さな盗作検出システムを構築しています。Google で調査を行ったところ、Google API (カスタム検索 API) を使用して剽窃検出ソフトウェアを構築できる可能性があることがわかりました。
この質問は非常に役に立ちました [剽窃防止サイトをどのようにコーディングしますか?]
次のコードを使用して、Google APIから検索結果を取得できました
<?php
ini_set('max_execution_time',300);
require_once '../../src/Google_Client.php';
require_once '../../src/contrib/Google_CustomsearchService.php';
session_start();
$client = new Google_Client();
$client->setApplicationName('Google CustomSearch PHP Starter Application');
$client->setDeveloperKey('MY_DEVELOPER_KEY');
$search = new Google_CustomsearchService($client);
$to_search="This is the text that should be searched in google so that the result that I obtain can be used by my codes to perform plagarism analysis";
$result = $search->cse->listCse($to_search, array('cx' => 'MY_SEARCH_ENGINE_ID'));
for($i=0; $i<6; $i++)
{
print "<pre>" . print_r($result, true) . "</pre>";
}
?>
$result 変数から、Google 検索から取得した [リンク]、[スニペット]、および [HTML スニペット] を取得しました。以下のコードを使用して
$result['items'][$i]['snippet'];
$result['items'][$i]['link'];
$i は loop から取得した整数値です。
問題は 、ご存知のように、Google で検索するための短いキーワードまたは数行しか送信できず、巨大なテキストは送信できないため、テキストの大きなチャンクを小さな行に分割して複数のクエリを実行する必要があるかどうかです。または私は何か他のことをすべきですか?私が取得するスニペットとリンク値は、盗用について分析できます。これを行うと、膨大な量のクエリが発生し、1 日あたり 100 クエリの制限を超えました。
私がやるべきことを行う適切な方法を教えてください。Google にクエリを実行してから、剽窃のユーザー入力を使用して巨大なテキストを分析する方法は、これは正しい方法ですか?