davanstrien HF Staff Claude Opus 4.5 commited on
Commit
5c4289f
·
1 Parent(s): 22b66f4

Add finepdfs-stats.py documentation to README

Browse files

- Add script table at top listing both scripts
- Add full documentation section for finepdfs-stats.py
- Include example commands and link to example output

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. README.md +55 -0
README.md CHANGED
@@ -14,6 +14,13 @@ Calculate essential text statistics for HuggingFace datasets using streaming mod
14
 
15
  ## Scripts
16
 
 
 
 
 
 
 
 
17
  ### `basic-stats.py` - Essential Text Statistics
18
 
19
  Calculate fundamental text statistics using pure Python (no ML dependencies). Uses streaming mode by default, so it works on datasets of any size without downloading the full dataset.
@@ -228,6 +235,54 @@ Character types are classified as:
228
 
229
  Simple heuristic-based sentence boundary detection using `.!?` as terminators. This is fast but not as accurate as NLP-based sentence tokenization. Good enough for statistical analysis.
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  ## Related Scripts
232
 
233
  Check out other scripts in the `uv-scripts` organization:
 
14
 
15
  ## Scripts
16
 
17
+ | Script | Description |
18
+ |--------|-------------|
19
+ | `basic-stats.py` | Essential text statistics (chars, words, sentences) for any dataset |
20
+ | `finepdfs-stats.py` | Temporal analysis of educational quality in finepdfs-edu |
21
+
22
+ ---
23
+
24
  ### `basic-stats.py` - Essential Text Statistics
25
 
26
  Calculate fundamental text statistics using pure Python (no ML dependencies). Uses streaming mode by default, so it works on datasets of any size without downloading the full dataset.
 
235
 
236
  Simple heuristic-based sentence boundary detection using `.!?` as terminators. This is fast but not as accurate as NLP-based sentence tokenization. Good enough for statistical analysis.
237
 
238
+ ---
239
+
240
+ ### `finepdfs-stats.py` - Temporal Educational Quality Analysis
241
+
242
+ Analyze educational quality trends across CommonCrawl dumps using Polars streaming. Answers: **"Is the web getting more educational over time?"**
243
+
244
+ **Features:**
245
+ - ✅ Polars streaming (no download of 300GB+ dataset)
246
+ - ✅ Temporal analysis across 106 CommonCrawl dumps (2013-2025)
247
+ - ✅ ASCII chart visualizations
248
+ - ✅ Uploads results to HF Hub with auto-generated dataset card
249
+ - ✅ Supports single language or all 70+ languages
250
+
251
+ **Quick Examples:**
252
+
253
+ ```bash
254
+ # Quick test (10K samples)
255
+ uv run https://huggingface.co/datasets/uv-scripts/dataset-stats/raw/main/finepdfs-stats.py \
256
+ --limit 10000 --show-plan
257
+
258
+ # Analyze English PDFs
259
+ uv run https://huggingface.co/datasets/uv-scripts/dataset-stats/raw/main/finepdfs-stats.py \
260
+ --output-repo username/my-stats
261
+
262
+ # Analyze ALL 70+ languages
263
+ uv run https://huggingface.co/datasets/uv-scripts/dataset-stats/raw/main/finepdfs-stats.py \
264
+ --all-languages --output-repo username/my-stats
265
+ ```
266
+
267
+ **Run on HF Jobs (recommended for full dataset):**
268
+
269
+ ```bash
270
+ hf jobs uv run \
271
+ -s HF_TOKEN \
272
+ -e HF_XET_HIGH_PERFORMANCE=1 \
273
+ https://huggingface.co/datasets/uv-scripts/dataset-stats/raw/main/finepdfs-stats.py \
274
+ -- --all-languages --output-repo username/finepdfs-temporal-stats
275
+ ```
276
+
277
+ **Example output:** [davanstrien/finepdfs-temporal-stats-all](https://huggingface.co/datasets/davanstrien/finepdfs-temporal-stats-all)
278
+
279
+ **Performance:**
280
+ - 50M docs in ~14 minutes (~60K docs/sec)
281
+ - Single scan using Polars streaming
282
+ - Works on HF Jobs CPU instances
283
+
284
+ ---
285
+
286
  ## Related Scripts
287
 
288
  Check out other scripts in the `uv-scripts` organization: