Skip to content

Update PDF batch-processing guidance and topic-modelling walkthrough - #3887

Closed
maehr wants to merge 3 commits into
programminghistorian:gh-pagesfrom
maehr:update-pdf-batch-processing-lesson
Closed

maehr wants to merge 3 commits into
programminghistorian:gh-pagesfrom
maehr:update-pdf-batch-processing-lesson

Conversation

@maehr

@maehr maehr commented Oct 21, 2026 •

Copy link
Copy Markdown

Related to #3860.

This revision updates installation guidance and makes PDF downloads, OCR and text extraction resumable. It preserves the PDF → OCR → text extraction → corpus analysis workflow and replaces DARIAH Topics Explorer with Simple Topic Modeling.

Changes

  • Refresh Windows with WSL, macOS and Linux installation guidance. Make additional Tesseract language packs optional.
  • Preserve source PDFs and write outputs to separate folders with predictable filenames. Skip completed outputs and report individual failures.
  • Keep --skip-text and --deskew in batch OCR. Explain --redo-ocr, --force-ocr, optional cleaning and changes to final page images.
  • Require exactly 340 filenames before ILO downloads start. Retain retries, temporary files, failure counts and the Zenodo alternative.
  • Restrict searches to extracted text. Explain ImageMagick 7 and 6 commands before use, and document explicit img2pdf installation.
  • Replace the DARIAH walkthrough with Simple Topic Modeling. Cover NMF, optional LDA, stop words, seeds, diagnostics, representative documents and exports.
  • Include the updated Figure 2 and its exported config.json. Preserve the existing DOI and configuration version.

Validation

  • Earlier validation checked the Zenodo archive checksum and its 340 text files. A fresh ILO directory listing also returned 340 English PDF filenames.
  • Earlier validation ran Simple Topic Modeling v2 with all 340 texts, English stop words, NMF, 30 topics, 5,000 terms and seed 42. The exported configuration loaded through the app.
  • Checked all 18 Bash examples with bash -n.
  • Tested complete, empty, incomplete and failed listings using small local HTTP fixtures. Verified retries, resume behaviour, filenames with spaces and failed-download cleanup.
  • Executed batch OCR and extraction on scanned, digital-text, poor-OCR and mixed-page PDF samples. Tested corrupt inputs, empty globs and commands that leave partial outputs.
  • Verified source hashes, preservation of existing outputs, predictable text filenames and failure counts. Both --redo-ocr and --force-ocr replaced deliberately incorrect hidden text.
  • Sample tests used OCRmyPDF 17.13.0, Tesseract 5.5.4 and Poppler 26.10.0 on macOS 26.6.2.
  • Checked YAML, configuration JSON, internal links, figure references and git diff --check. Inspected a Pandoc HTML preview and verified that rendered code blocks preserve the commands.

Remaining validation limits

  • The complete corpus workflow, clean installations, Linux, Windows with WSL and ImageMagick commands remain untested.
  • bundle exec jekyll build failed locally because Bundler 2.4.22 is unavailable. Chrome was unavailable for visual browser review. The Pandoc preview does not replace a Jekyll build.

claude and others added 2 commits October 21, 2026 11:44
…Explorer

Addresses programminghistorian#3860 with targeted guidance updates
that keep the lesson's approach:

- Add an update notice that lists the changes and the tool versions used
  to check the commands.
- Replace the Windows 10 / Ubuntu 18.04 WSL steps with `wsl --install`,
  the obsolete Homebrew installer with the current one, and the Ubuntu
  18.04 instructions with current Ubuntu LTS. Install only the English
  Tesseract data and explain how to add other languages.
- Never overwrite source PDFs: OCRmyPDF, pdftotext and pdfimages now
  write to separate `ocr/`, `text/` and `images/` folders with
  predictable file names.
- Use `--skip-text` for batch OCR, since OCRmyPDF aborts on pages that
  already contain text by default. Drop `--clean` from the default
  commands, explain that it needs unpaper, and mention `--redo-ocr` and
  `--force-ocr` for bad text layers.
- Restrict the grep examples to the `text/` folder.
- Use ImageMagick 7's `magick` command and explain the `convert`
  fallback and the img2pdf workaround for the PDF security policy.
- Replace the ILO download one-liner with a readable loop that reports
  the file count, fails loudly, can resume, and points to Zenodo.
- Replace DARIAH Topics Explorer with Simple Topic Modeling
  (https://maehr.github.io/simple-topic-modeling/): NMF with TF-IDF as
  the default, LDA as an option, stop words, random seed, diagnostics,
  and repeatable runs through config.json. Remove the DARIAH screenshot.
- Update the WSL, grep and topic-model references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018k44PqSnqQ4gfSwQHwq2E9
@anisa-hawes anisa-hawes self-assigned this Oct 21, 2026
@maehr
maehr marked this pull request as ready for review October 22, 2026 06:44
Copilot AI balanced review requested due to automatic review settings October 22, 2026 06:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@maehr

maehr commented Oct 22, 2026

Copy link
Copy Markdown
Author

@anisa-hawes, thanks for reviewing this PR. As you can see, I used Claude (Opus 5.5/High) for assistance. I hope this is okay with you and with the Programming Historian's AI rules.

Check the ILO corpus size before downloads. Preserve complete outputs and report processing failures. Correct dependency and cleaning guidance. Remove the unsupported version claim.
@anisa-hawes

anisa-hawes commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Hello Moritz @maehr,

To reiterate Laura's comment in Issue 3887, I’m closing this PR.

If you’d like to propose short information or guidance panels, please add them to the issue thread and indicate where they should appear in the lesson.

I’ll then take care of implementing the changes in a new PR. As Laura @lachapot explained, all direct updates to our site are managed by our team.

Thank you.
Anisa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants