🔵 🔵 🔵


Encounters

၊၊||၊|။

EbookLib ○›|encounter|ENC|20260905215548-01-•

Good — and that whittle-down design is smart: it gives you a clean audit trail (never touch the master export) while letting each book pass shrink the “still unaccounted for” pile.

Two scripts:Workflow for one book:

pip install ebooklib💜 beautifulsoup4 --break-system-packages
 
python epub_to_text.py --in book.epub --out book.txt --lang japanese
 
python match_book.py --notes japanese.json --book-text book.txt --lang japanese \
 --book-name "Book Title"

That produces matches_Book Title.json (matched notes, each tagged with which book, which candidate sentence matched, and the match length — handy for spot-checking) and japanese_remaining_<timestamp>.json (everything else, ready to feed into the next book’s run as your new --notes input). japanese.json itself is never touched.

A couple of things worth doing before running this over your whole library:

  1. Sanity-check on a book you’re sure is/isn’t in there. Run it once against a book you know contains some of your cards, confirm the matches look right and the count is sane; then run it against something you’re sure isn’t a source, to confirm you get zero (or near-zero) false positives with the default thresholds.
  2. Tune --match-len if needed. 20 characters is a reasonable default for Japanese (quite unlikely to collide by accident), but if you see false positives on short/generic sentences, raise it; if genuine matches are getting missed (e.g. very short example sentences), lower it.

Want me to also write a small helper that loops match_book.py over every EPUB in a folder automatically, or do you want to run these one at a time by hand for now while you dial in the thresholds?

Source: Claude Sonnet ○˒

(echo:: @ )

Link to original