文档计数不等于文本计数:Web-PDF 语料库统计中的单位偏差
文章背景与核心概要
PDF 语料库在描述规模时通常以 Token(词元)总量为准,但在计算覆盖率、OCR 路由和语言分布等关键指标时,却往往基于“文档”这一单位进行统计,且未对 Token 总量进行拆解。这种做法掩盖了文档数量与实际文本量之间的巨大差异。
本文通过对 CC-MAIN-2021-31-PDF-UNTRUNCATED 语料库的深入分析,揭示了严重的“单位偏差”现象:极少数文档占据了绝大部分文本内容(例如 3.02% 的文档贡献了 50% 的 Token)。此外,研究还指出,常见的截断策略(Truncation Caps)会导致大量文本被不成比例地丢弃,使得基于文档层面的统计数据无法真实反映语料库的构成。作者建议,未来的语料库统计应同时报告文档和 Token 两个维度的指标。
摘要
PDF 语料库通常以 Token 数量来宣传其规模,但在发布各项比率(如覆盖率、OCR 路由、重新获取恢复率、语言混合)时,却均以文档为单位进行计算,且从未对 Token 总量进行过分解。这两种单位之间存在显著差异。
PDF corpora advertise their size in tokens but compute every rate they publish (coverage, OCR routing, re-fetch recovery, language mix) per document, and none decomposes its token total. The two units diverge sharply.
在 CC-MAIN-2021-31-PDF-UNTRUNCATED(包含 790 万个 Web PDF,326 亿个 Token)中,3.02% 的含文本文档占据了总 Token 的一半(基尼系数为 0.807);超过 50 页的文档仅占语料库的 5.00%,却贡献了 53.53% 的文本。由 \(\TeX\) 工具链生成的 PDF 占文档总数的 1.66%,却占文本总量的 4.05%。
On
CC-MAIN-2021-31-PDF-UNTRUNCATED(7.9M web PDFs, 32.6B tokens), 3.02% of text-bearing documents hold half the tokens (Gini 0.807); documents over 50 pages are 5.00% of the corpus but 53.53% of its text. The PDFs produced by a \(\TeX\) toolchain are 1.66% of documents and 4.05% of the text.
最明显的受害者是 Common Crawl 的截断上限:它影响了 23.06% 的文档和 63.08% 的文本。通过重建被截断的文件并提取两个版本,两个广泛使用的库分别仅恢复了 11.4% 和 1.4% 的文本;受影响的文档中,有 72% 到 97% 无法提取出任何内容;语料库中约 55–62% 的文本因此丢失。在 2025 年 3 月采用 5 MiB 的上限下,仍有 30.19% 的 Token 会被截断,而这些文档的恢复率仅从 3.3% 上升至 13.2%。
The clearest casualty is Common Crawl's truncation cap: it affected 23.06% of documents and 63.08% of the text. Reconstructing the truncated files and extracting both versions, two widely used libraries recover 11.4% and 1.4% of that text; between 72% and 97% of affected documents yield nothing; roughly 55–62% of the corpus's text is lost. Under the 5 MiB cap adopted in March 2025, 30.19% of tokens would still be truncated, and recovery on those documents rises only from 3.3% to 13.2%.
建议: 语料库统计应同时以文档和 Token 两种单位进行报告。
Recommendation: Corpus statistics should be reported in both units: documents and tokens.
获取全文与资源
- PDF 版本: View PDF
- HTML 版本: HTML (experimental)
- 源文件: TeX Source
- 外部索引:
- Google Scholar
- Semantic Scholar
- NASA ADS