Evals / documents / Multi-step jobs
Word count and a Word copy of an e-book
A client wants a quote to translate frankenstein.epub. I charge per word, so write the book's word count to words.txt, and give me an editable Word copy, frankenstein.docx, to work in.
The task
The reference answer shows the job can be done with deft. It is not an agent run.
deft epub info frankenstein.epub > words.txt deft epub to-md frankenstein.epub -o book.md deft md to-docx book.md -o frankenstein.docx
Input
[OEBPS/4328224471496264690_84-h-0.htm.xhtml] The Project Gutenberg eBook of Frankenstein; or, The modern Prometheus This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org . If you are not located in the United States, you will have to check the laws of the country where you are located before usi [OEBPS/4328224471496264690_84-h-1.htm.xhtml] CONTENTS Letter 1 Letter 2 Letter 3 Letter 4 Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 [OEBPS/4328224471496264690_84-h-2.htm.xhtml] Letter 1 To Mrs. Saville, England. St. Petersburgh, Dec. 11th, 17—. You will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking. I am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces [OEBPS/4328224471496264690_84-h-3.htm.xhtml] Letter 2 To Mrs. Saville, England. Archangel, 28th March, 17—. How slowly the time passes here, encompassed as I am by frost and snow! Yet a second step is taken towards my enterprise. I have hired a vessel and am occupied in collecting my sailors; those whom I have already engaged appear to be men on whom I can depend and are certainly possessed of dauntless courage. But I have one want which I have never yet been able to satisfy, and the absence of the object of which I now feel as a most seve [OEBPS/4328224471496264690_84-h-4.htm.xhtml] Letter 3 To Mrs. Saville, England. July 7th, 17—. My dear Sister, I write a few lines in haste to say that I am safe—and well advanced on my voyage. This letter will reach England by a merchantman now on its homeward voyage from Archangel; more fortunate than I, who may not see my native land, perhaps, for many years. I am, however, in good spirits: my men are bold and apparently firm of purpose, nor do the floating sheets of ice that continually pass us, indicating the dangers of the region tow [OEBPS/4328224471496264690_84-h-5.htm.xhtml] Letter 4 To Mrs. Saville, England. August 5th, 17—. So strange an accident has happened to us that I cannot forbear recording it, although it is very probable that you will see me before these papers can come into your possession. Last Monday (July 31st) we were nearly surrounded by ice, which closed in the ship on all sides, scarcely leaving her the sea-room in which she floated. Our situation was somewhat dangerous, espe … 3352 more characters
Reference output
 ## The Project Gutenberg eBook of Frankenstein; or, The modern Prometheus This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at [www.gutenberg.org](https://www.gutenberg.org). If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook. **Title**: Frankenstein; or, The modern Prometheus **Author**: Mary Wollstonecraft Shelley **Release date**: October 1, 1993 \[eBook #84\] Most recently updated: February 10, 2026 **Language**: English **Other information and formats**: [www.gutenberg.org/ebooks/84](https://www.gutenberg.org/ebooks/84) **Credits**: Judith Boss, Christy Phillips, Lynn Hanninen and David Meltzer. HTML version by Al Haines. Further corrections by Menno de Leeuw. \*\*\* START OF THE PROJECT GUTENBERG EBOOK FRANKENSTEIN; OR, THE MODERN PROMETHEUS \*\*\* # Frankenstein; ### or, the Modern Prometheus ## by Mary Wollstonecraft (Godwin) Shelley * * * ## CONTENTS Letter 1 Letter 2 Letter 3 Letter 4 Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 ## Letter 1 *To Mrs. Saville, England.* St. Petersburgh, Dec. 11th, 17—. You will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking. I am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling? This breeze, which has travelled from the regions towards which I am advancing, gives me a foretaste of those icy climes. Inspirited by this wind of promise, my daydreams become more fervent and vivid. I try in vain to be persuaded that the pole is the seat of frost and desolation; it ever presents itself to my imagination as the region of beauty and delight. There, Margaret, the sun is for ever visible, its broad disk just skirting the horizon and diffusing a perpetual splendour. There—for with your leave, my sister, I will put some trust in preceding navigators—there snow and frost are banished; and, sailing over a calm sea, we may be wafted to a land surpassing in wonders and in beauty every region hitherto discovered on the habitable globe. Its productions and features may be without example, as the phenomena of the heavenly bodies un … 196023 more characters

Rendered by macOS Quick Look, first page
Text inside
Cover The Project Gutenberg eBook of Frankenstein; or, The modern Prometheus This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook. Title: Frankenstein; or, The modern Prometheus Author: Mary Wollstonecraft Shelley Release date: October 1, 1993 [eBook #84] Most recently updated: February 10, 2026 Language: English Other information and formats: www.gutenberg.org/ebooks/84 Credits: Judith Boss, Christy Phillips, Lynn Hanninen and David Meltzer. HTML version by Al Haines. Further corrections by Menno de Leeuw. *** START OF THE PROJECT GUTENBERG EBOOK FRANKENSTEIN; OR, THE MODERN PROMETHEUS *** Frankenstein; or, the Modern Prometheus by Mary Wollstonecraft (Godwin) Shelley CONTENTS Letter 1 Letter 2 Letter 3 Letter 4 Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Letter 1 To Mrs. Saville, England. St. Petersburgh, Dec. 11th, 17—. You will rejoice to hear that no disaster has accompanied the commencement of an enterprise which you have regarded with such evil forebodings. I arrived here yesterday, and my first task is to assure my dear sister of my welfare and increasing confidence in the success of my undertaking. I am already far north of London, and as I walk in the streets of Petersburgh, I feel a cold northern breeze play upon my cheeks, which braces my nerves and fills me with delight. Do you understand this feeling? This breeze, which has travelled from the regions towards which I am advancing, gives me a foretaste of those icy climes. Inspirited by this wind of promise, my daydreams become more fervent and vivid. I try in vain to be persuaded that the pole is the seat of frost and desolation; it ever presents itself to my imagination as the region of beauty and delight. There, Margaret, the sun is for ever visible, its broad disk just skirting the horizon and diffusing a perpetual splendour. There—for with your leave, my sister, I will put some trust in preceding navigators—there snow and frost are banished; and, sailing over a calm sea, we may be wafted to a land surpassing in wonders and in beauty every region hitherto discovered on the habitable globe. Its productions and features may be without example, as the phenomena of the heavenly bodies undoubtedly are in those undiscovered solitudes. What may not be expected in a country of eternal light? I may there discover the wondrous power which attracts the needle and may regulate a thousand celestial obser … 434398 more characters
ok epub.info frankenstein.epub 32 chapters title="Frankenstein; or, The modern Prometheus" author="Mary Wollstonecraft Shelley" language=en chapters=32 images=1 words=78149
How a result is judged (2 checks)
- python: code = "import re\nnums = [int(n.replace(',', '')) for n in re.findall(r'\\d[\\d,]*', open('words.txt').read())]\nassert any(66000 <= n <= 90000 for n in nums), f'no word count near 78,000 in {nums}'\n"
- python: code = "import html, re, zipfile\nx = zipfile.ZipFile('frankenstein.docx').read('word/document.xml').decode('utf-8')\ntext = re.sub(r'\\s+', ' ', html.unescape(re.sub(r'<[^>]+>', ' ', x)))\norder = ['St. Petersburgh', 'I am by birth a Genevese', 'lost in darkness and distance']\nat = [text.find(s) for s in order]\nassert -1 not in at and at == sorted(at), f'book text missing or out of order: {at}'\nassert len(text.split()) > 60000, 'not the whole book'\n"
Runs
Claude Opus 5.5Without deftPassed2026-11-15
- Time
- 68s
- New tokens
- 30.4k
- Total input
- 176.1k
- Output tokens
- 6.6k
- Commands
- 7
- Failed
- 2
Trace
ls -la; which pandoc python3; python3 -c "import docx" 2>&1 (exit 1)output
Exit code 1 total 864 drwxr-xr-x@ 4 user staff 128 Nov 14 19:55 . drwx------@ 305 user staff 9760 Nov 14 19:55 .. drwxr-xr-x@ 3 user staff 96 Nov 14 19:55 .claude -rw-r--r--@ 1 user staff 440131 Nov 5 21:11 frankenstein.epub pandoc not found ~/opt/anaconda3/bin/python3 Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'docx'
mkdir -p "$TMPDIR/epub" && cd "$TMPDIR/epub" && unzip -o -q frankenstein.epub && find . -type f | head -50 && cat META-INF/container.xml && cat $(find . -name "*.opf") | head -80output
./META-INF/container.xml ./mimetype ./OEBPS/4328224471496264690_84-h-29.htm.xhtml ./OEBPS/4328224471496264690_84-h-7.htm.xhtml ./OEBPS/4328224471496264690_84-h-24.htm.xhtml ./OEBPS/4328224471496264690_84-h-30.htm.xhtml ./OEBPS/4328224471496264690_84-h-11.htm.xhtml ./OEBPS/4328224471496264690_84-h-1.htm.xhtml ./OEBPS/4328224471496264690_84-h-17.htm.xhtml ./OEBPS/4328224471496264690_84-h-22.htm.xhtml ./OEBPS/4328224471496264690_84-h-28.htm.xhtml ./OEBPS/4328224471496264690_84-h-6.htm.xhtml ./OEBPS/4328224471496264690_84-h-25.htm.xhtml ./OEBPS/4328224471496264690_84-h-10.htm.xhtml ./OEBPS/wrap0000.xhtml ./OEBPS/4328224471496264690_84-h-0.htm.xhtml ./OEBPS/4328224471496264690_84-h-16.htm.xhtml ./OEBPS/toc.xhtml ./OEBPS/4328224471496264690_84-h-23.htm.xhtml ./OEBPS/4328224471496264690_84-h-5.htm.xhtml ./OEBPS/4328224471496264690_84-h-13.htm.xhtml ./OEBPS/4328224471496264690_84-h-8.htm.xhtml ./OEBPS/4328224471496264690_84-h-26.htm.xhtml ./OEBPS/4328224471496264690_84-h-3.htm.xhtml ./OEBPS/content.opf ./OEBPS/4328224471496264690_84-h-18.htm.xhtml ./OEBPS/pgepub.css ./OEBPS/4328224471496264690_84-h-20.htm.xhtml ./OEBPS/1.css ./OEBPS/0.css ./OEBPS/4328224471496264690_84-h-15.htm.xhtml ./OEBPS/4328224471496264690_84-h-4.htm.xhtml ./OEBPS/4328224471496264690_84-h-12.htm.xhtml ./OEBPS/4328224471496264690_84-h-9.htm.xhtml ./OEBPS/4328224471496264690_84-h-27.htm.xhtml ./OEBPS/toc.ncx ./OEBPS/4328224471496264690_84-h-2.htm.xhtml ./OEBPS/4328224471496264690_84-h-19.htm.xhtml ./OEBPS/43282244 … 6093 more characters
cd "$TMPDIR/epub/OEBPS"; sed -n '/<spine/,/<\/spine>/p' content.opf; for f in 4328224471496264690_84-h-0.htm.xhtml 4328224471496264690_84-h-1.htm.xhtml 4328224471496264690_84-h-30.htm.xhtml 4328224471496264690_84-h-29.htm.xhtml; do echo "=== $f"; sed -e 's/<[^>]*>//g' "$f" | tr -s ' \n' | head -c 1500; echo; doneoutput
<spine toc="ncx2"> <itemref idref="coverpage-wrapper"/> <itemref idref="pg-header"/> <itemref idref="item4"/> <itemref idref="item5"/> <itemref idref="item6"/> <itemref idref="item7"/> <itemref idref="item8"/> <itemref idref="item9"/> <itemref idref="item10"/> <itemref idref="item11"/> <itemref idref="item12"/> <itemref idref="item13"/> <itemref idref="item14"/> <itemref idref="item15"/> <itemref idref="item16"/> <itemref idref="item17"/> <itemref idref="item18"/> <itemref idref="item19"/> <itemref idref="item20"/> <itemref idref="item21"/> <itemref idref="item22"/> <itemref idref="item23"/> <itemref idref="item24"/> <itemref idref="item25"/> <itemref idref="item26"/> <itemref idref="item27"/> <itemref idref="item28"/> <itemref idref="item29"/> <itemref idref="item30"/> <itemref idref="item31"/> <itemref idref="item32"/> <itemref idref="pg-footer"/> </spine> === 4328224471496264690_84-h-0.htm.xhtml Frankenstein; The Project Gutenberg eBook of Frankenstein; or, The modern Prometheus This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to chec … 4072 more characterscd "$TMPDIR/epub/OEBPS"; cat 4328224471496264690_84-h-0.htm.xhtml | head -c 4000; echo; echo ====; head -c 2500 4328224471496264690_84-h-5.htm.xhtml; grep -o '<[a-z0-9]*' *.htm.xhtml | cut -d: -f2 | sort | uniq -c (exit 1)output
Exit code 1 <?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en"><head> <meta charset="utf-8"/><title>Frankenstein;</title> <link href="7423641491831241083_cover.jpg" rel="icon" type="image/x-cover" id="id-5164725811184219298"/> <link href="0.css" rel="stylesheet" type="text/css"/> <link href="1.css" rel="stylesheet" type="text/css"/> <link href="pgepub.css" rel="stylesheet" type="text/css"/> <meta name="generator" content="Ebookmaker 0.14.6 by Project Gutenberg"/> </head> <body class="x-ebookmaker x-ebookmaker-3"><header class="pg-boilerplate pgheader" id="pg-header" lang="en"><h2 id="pg-header-heading" title="">The Project Gutenberg eBook of <span lang="en" id="pg-title-no-subtitle">Frankenstein; or, The modern Prometheus</span></h2> <div>This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at <a class="reference external" href="https://www.gutenberg.org">www.gutenberg.org</a>. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook.</div> <div class="container" id="pg-machine-header"><p><strong>Title</strong>: Frankenstein; or, The modern Prometheus</p> <div id="pg-header-authl … 939 more characterscd "$TMPDIR/epub/OEBPS"; head -c 2000 4328224471496264690_84-h-5.htm.xhtml; echo; cat *.htm.xhtml | grep -o '<[a-z0-9]\+' | sort | uniq -c; grep -o 'class="pg-boilerplate[^"]*"' *.xhtml; grep -c . 4328224471496264690_84-h-30.htm.xhtml; grep -o '<body.\{0,200\}' 4328224471496264690_84-h-30.htm.xhtmloutput
<?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en"><head> <meta charset="utf-8"/><title>Letter 4</title> <link href="7423641491831241083_cover.jpg" rel="icon" type="image/x-cover" id="id-5164725811184219298"/> <link href="0.css" rel="stylesheet" type="text/css"/> <link href="1.css" rel="stylesheet" type="text/css"/> <link href="pgepub.css" rel="stylesheet" type="text/css"/> <meta name="generator" content="Ebookmaker 0.14.6 by Project Gutenberg"/> </head> <body class="x-ebookmaker x-ebookmaker-3"><div class="chapter" id="pgepubid00006"> <h2><a id="letter4"/>Letter 4</h2> <p class="letter2"> <i>To Mrs. Saville, England.</i> </p> <p class="right"> August 5th, 17—. </p> <p> So strange an accident has happened to us that I cannot forbear recording it, although it is very probable that you will see me before these papers can come into your possession. </p> <p> Last Monday (July 31st) we were nearly surrounded by ice, which closed in the ship on all sides, scarcely leaving her the sea-room in which she floated. Our situation was somewhat dangerous, especially as we were compassed round by a very thick fog. We accordingly lay to, hoping that some change would take place in the atmosphere and weather. </p> <p> About two o’clock the mist cleared away, and we beheld, stretched out in every direction, vast and irregular plains of ice, which seemed to have no end. Some of my comrades groaned, and … 1043 more characters
mkdir -p "$TMPDIR/scripts" && cat > "$TMPDIR/scripts/convert.py" <<'EOF' import sys, os, re, zipfile import xml.etree.ElementTree as ET from xml.sax.saxutils import escape epub_dir, out_docx, out_words, full_words_out = sys.argv[1:5] NS = '{http://www.w3.org/1999/xhtml}' OPF = '{http://www.idpf.org/2007/opf}' oebps = os.path.join(epub_dir, 'OEBPS') opf = ET.parse(os.path.join(oebps, 'content.opf')).getroot() manifest = {i.get('id'): i.get('href') for i in opf.iter(OPF + 'item')} spine = [manifest[r.get('idref')] for r in opf.iter(OPF + 'itemref')] BLOCKS = {'h1': 'Heading1', 'h2': 'Heading2', 'h3': 'Heading3', 'p': None, 'td': None, 'li': None} paras = [] # (style, [(text, italic, bold)]) boiler_text = [] def tag(e): return e.tag.replace(NS, '') if isinstance(e.tag, str) else '' def runs_of(e, italic=False, bold=False, out=None): if out is None: out = [] t = tag(e) it = italic or t in ('i', 'em'); bd = bold or t in ('strong', 'b') if t == 'br': out.append(('\n', it, bd)) if e.text: out.append((e.text, it, bd)) for c in e: runs_of(c, it, bd, out) if c.tail: out.append((c.tail, italic, bold)) return out def walk(e, in_blockquote=False): t = tag(e) if 'pg-boilerplate' in (e.get('class') or ''): boiler_text.append(''.join(e.itertext())); return if t in BLOCKS: style = BLOCKS[t] or ('Quote' if in_blockquote else None) paras.append((style, runs_of(e))); return for c in e: walk(c, in_blockquote or t == 'blockquote') for href in spine: if not href.endswith('.htm.xhtml'): continue body = ET.parse(os.path.join(oebps, href)).getroot().find(NS + 'body') walk(body) def norm(runs): # collapse source line-wrapping whitespace, keep explicit <br/> out = [] for text … 5367 more charactersoutput
paragraphs 820 book words 75041 boilerplate words 3053 75041 total 1192 drwxr-xr-x@ 6 user staff 192 Nov 14 19:56 . drwx------@ 305 user staff 9760 Nov 14 19:56 .. drwxr-xr-x@ 3 user staff 96 Nov 14 19:55 .claude -rw-r--r--@ 1 user staff 161417 Nov 14 19:56 frankenstein.docx -rw-r--r--@ 1 user staff 440131 Nov 5 21:11 frankenstein.epub -rw-r--r--@ 1 user staff 6 Nov 14 19:56 words.txt
Checking that the .docx opens correctly and that the count matches an independent tool.
python3 -I -c " import zipfile,xml.dom.minidom as m;z=zipfile.ZipFile('frankenstein.docx') [m.parseString(z.read(n)) for n in z.namelist()];print('xml ok')" && textutil -convert txt -stdout frankenstein.docx > "$TMPDIR/out.txt" && wc -w "$TMPDIR/out.txt" && head -12 "$TMPDIR/out.txt" && echo ... && tail -4 "$TMPDIR/out.txt" | cut -c1-200output
xml ok 75042 <tmp> Frankenstein; or, the Modern Prometheus by Mary Wollstonecraft (Godwin) Shelley CONTENTS Letter 1 Letter 2 Letter 3 Letter 4 Chapter 1 Chapter 2 Chapter 3 Chapter 4 ... “Fear not that I shall be the instrument of future mischief. My work is nearly complete. Neither yours nor any man’s death is needed to consummate the series of my being and accomplish that which “Farewell! I leave you, and in you the last of humankind whom these eyes will ever behold. Farewell, Frankenstein! If thou wert yet alive and yet cherished a desire of revenge against me, it would b “But soon,” he cried with sad and solemn enthusiasm, “I shall die, and what I now feel be no longer felt. Soon these burning miseries will be extinct. I shall ascend my funeral pile triumphantly He sprang from the cabin-window as he said this, upon the ice raft which lay close to the vessel. He was soon borne away by the waves and lost in darkness and distance.
I've written both files: **words.txt** says **75,041 words**, and **frankenstein.docx** is your editable copy. **What the count includes:** the title page, table of contents, Walton's four letters, all 24 chapters and the closing letters. That's everything a translator would need to translate. **What it leaves out:** the file is a Project Gutenberg edition, so it comes with Gutenberg's own header and a long license at the end. Together those add about 3,050 words. They aren't part of the novel and wouldn't be translated, so I left them out of both the count and the Word file. If the client wants them included, the total would be about 78,090. **How it was counted:** words are pieces of text separated by spaces, which is how Word counts. Lines made only of punctuation, like the "17—." date lines, aren't counted. I checked the result against macOS's own converter, which came out one wor
Output
Its files were not kept in this run. The last line of the trace is its own report.
Claude Opus 5.5With deft, skill installedPassedRead the skillUsed deft2026-11-15
- Time
- 26s
- New tokens
- 15.8k
- Total input
- 120.8k
- Output tokens
- 1.5k
- Commands
- 5
- Failed
- 0
Trace
Loaded the deft skill
ls -la; deft epub; deft find "epub to word"output
total 864 drwxr-xr-x@ 4 user staff 128 Nov 14 19:56 . drwx------@ 305 user staff 9760 Nov 14 19:56 .. drwxr-xr-x@ 4 user staff 128 Nov 14 19:56 .claude -rw-r--r--@ 1 user staff 440131 Nov 5 21:11 frankenstein.epub deft epub - commands (input -> output) info epub -> report Title, author, language, chapters, images, words from-md md... -> epub Make an e-book; each top-level heading starts a chapter to-md epub -> md Convert the whole book to Markdown to-pdf epub -> pdf Typeset the book as PDF to-text epub -> txt Extract plain text in reading order More: deft epub <command> --help epub info epub -> report Title, author, language, chapters, images, words
deft epub info frankenstein.epub; deft md; deft epub to-md --helpoutput
ok epub.info frankenstein.epub 32 chapters title="Frankenstein; or, The modern Prometheus" author="Mary Wollstonecraft Shelley" language=en chapters=32 images=1 words=78149 deft md - commands (input -> output) from-docx doc -> md Convert to Markdown, keeping headings, lists and tables from-html html -> md Convert to Markdown; scripts and styles are dropped to-docx md -> docx Write a Word document with headings, lists, tables, images to-epub md... -> epub Make an e-book; each top-level heading starts a chapter to-html md -> html Render to a styled HTML page, or --fragment to-pdf md -> pdf Typeset Markdown as PDF toc md -> md Insert a table of contents from the headings More: deft md <command> --help deft epub to-md - Convert the whole book to Markdown Same as: deft convert Usage: deft epub to-md <epub>... [-o <md|dir>] [options] In: epub (each handled separately) Out: md (default <name>.<ext>) Options: --images <path> Folder for embedded pictures Common: -o --force --dry-run --json -j (deft help common) Examples: deft epub to-md book.epub -o book.md Result fields: chapters
W=$TMPDIR/fk; mkdir -p $W; deft epub to-md frankenstein.epub -o $W/frankenstein.md --images $W/images; deft epub to-text frankenstein.epub -o $W/f.txt; wc -w $W/f.txt; grep -n -i "gutenberg" $W/f.txt | head -20output
ok epub.to-md frankenstein.epub -> <tmp> 32 chapters 0.03s ok epub.to-text frankenstein.epub -> <tmp> 32 chapters 0.03s 78111 <tmp> 3:The Project Gutenberg eBook of Frankenstein; or, The modern Prometheus 5:This eBook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this eBook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook. 16:Other information and formats: www.gutenberg.org/ebooks/84 21:*** START OF THE PROJECT GUTENBERG EBOOK FRANKENSTEIN; OR, THE MODERN PROMETHEUS *** 1690:*** END OF THE PROJECT GUTENBERG EBOOK FRANKENSTEIN; OR, THE MODERN PROMETHEUS *** 1694:Creating the works from print editions not protected by U.S. copyright law means that no one owns a United States copyright in these works, so the Foundation (and you!) can copy and distribute it in the United States without permission and without paying copyright royalties. Special rules, set forth in the General Terms of Use part of this license, apply to copying and distributing Project Gutenberg™ electronic works to protect the PROJECT GUTENBERG™ concept and trademark. Project Gutenberg is a registered trademark, and may not be used if you charge for an eBook, except by following the terms … 6424 more characters
W=$TMPDIR/fk; awk '/\*\*\* START OF THE PROJECT GUTENBERG/{f=1;next} /\*\*\* END OF THE PROJECT GUTENBERG/{f=0} f' $W/f.txt | wc -w; deft md to-docx $W/frankenstein.md -o frankenstein.docx; deft doc to-text frankenstein.docx -o $W/check.txt; wc -w $W/check.txtoutput
75042 ok md.to-docx <tmp> -> frankenstein.docx 78107 words 0.02s ok doc.to-text frankenstein.docx -> <tmp> 78106 words 0.01s 78110 <tmp>
Both files are almost done. I'm saving the count and checking that the Word file kept the book's image.
echo 75042 > words.txt; cat words.txt; unzip -l frankenstein.docx | grep -i media; ls -laoutput
75042 224340 01-01-1980 00:00 word/media/7423641491831241083_cover.jpg total 1592 drwxr-xr-x@ 6 user staff 192 Nov 14 19:56 . drwx------@ 305 user staff 9760 Nov 14 19:56 .. drwxr-xr-x@ 4 user staff 128 Nov 14 19:56 .claude -rw-r--r--@ 1 user staff 365836 Nov 14 19:56 frankenstein.docx -rw-r--r--@ 1 user staff 440131 Nov 5 21:11 frankenstein.epub -rw-r--r--@ 1 user staff 6 Nov 14 19:56 words.txt
I've created both files in the current directory. **words.txt: 75,042 words.** That's the novel itself: all 32 chapters, plus the title page and front matter that are part of the book. This epub is the Project Gutenberg edition, so it also contains Gutenberg's own text: a short header at the start and a long license at the end. That text isn't part of Mary Shelley's book and nobody would translate it, so I left it out of the count. With it included the total is about 78,150 words. Quoting the full number would overcharge the client by about 3,100 words, roughly 4%. **frankenstein.docx** is an ordinary editable Word document. It keeps the headings for each chapter and the cover image. I extracted the text back out of it, and the word count matched the source, so no text was lost in conversion. It still has the Gutenberg header at the top and the license at the end. You can delete those
Output
Its files were not kept in this run. The last line of the trace is its own report.