Closed2

Common Crawlから日本語データを取り出す

vzvu3k6kvzvu3k6k

Common Crawlのcontent_languagesカラムを参照する

content_languagesカラムとは

The language of a document is identified by Compact Language Detector 2 (CLD2). It is able to identify 160 different languages and up to 3 languages per document. The table lists the percentage covered by the primary language of a document (returned first by CLD2). So far, only HTML pages are passed to the language detector.

https://commoncrawl.github.io/cc-crawl-statistics/plots/languages

CLD2の判定結果が記録されている。CLD2は1つのテキストに対して複数の判定結果を英語(eng)とポーランド語(pol)のように複数の言語が含まれている場合は、eng,pol,で結合される。

Athenaで収集する

Athenaで次のクエリを実行する。

SELECT
    warc_filename,
    warc_record_offset,
    warc_record_length
FROM ccindex
WHERE
    crawl = 'CC-MAIN-2023-50'
    AND subset = 'warc'
    AND content_languages = 'jpn' -- 日本語のみと判定されたレコードだけ
;
  • キュー内の時間: 107 ミリ秒

  • 実行時間: 1 分 32.493 秒

  • スキャンしたデータ: 31.99 GB

  • レコード数: 74,044,705

  • CSVのサイズ: 153.2 KB

参考: urlカラムも取得した場合

SELECT
    url,
    warc_filename,
    warc_record_offset,
    warc_record_length
FROM ccindex
WHERE
    crawl = 'CC-MAIN-2023-50'
    AND subset = 'warc'
    AND content_languages = 'jpn'
;

クエリの実行結果

  • キュー内の時間: 122 ミリ秒

  • 実行時間: 1 分 50.652 秒

  • スキャンしたデータ: 72.20 GB

  • レコード数: 74,044,705

  • CSVのサイズ: 13.9GB

Tips

このスクラップは2025/03/12にクローズされました