Test cases / pdf

deft pdf ocr

Make a scan searchable

6 runs on real files, 2 tests on generated files, not shown. 0 failed.

Fixed cases

Generated files, compared with ground truth by tools other than deft.

a real scan of a book pagePassed

deft pdf ocr huck-finn-scan.pdf -o out.pdf
deft pdf to-text out.pdf -o out.txt

Input

huck-finn-scan.pdf 164.0 KB · 1 page
Page 1

Output

out.pdf 180.1 KB · 1 page
Page 1
out.txt 1.4 KB
ELL, I got a good going-over in the morning,
from old Miss Watson, on account of my
clothes ; but the widow she didn’t scold, but
only cleaned off the grease and clay and
looked so sorry that I thought I would be-
have a while if I could. Then Miss Watson
she took me in the closet and prayed, but
| nothing come of it. She told me to pray
me) h ty). every day, and whatever I asked for I would
a) | | i | get it. But it warn’t so. I tried it. Once
I got a fish-line, but no hooks. Jt warn’t
any good to me without hooks. I tried for
the hooks three or four times, but somehow
I couldn’t make it work. By-and-by, one
day, I asked Miss Watson to try for me, but
she said I was a fool. She never told me
why, and I couldn’t make it out no way.
I set down, one time, back in the woods, and had a long think about it. I
says to myself, if a body can get anything they pray for, why don’t Deacon
Winn get back the money he lost on pork? Why can’t the widow get back
her silver snuff-box that was stole? Why can’t Miss Watson fat up? No, says
I to myself, there ain’t nothing in it. I went and told the widow about it,
and she said the thing a body could get by praying for it was “spiritual gifts.”
This was too many for me, but she told me what she meant—I must help
other people, and do everything I could for other people, and look out for them
all the time, and never think about myself. This was including Miss Watson,
MISS WATSON’S LECTURE.
What it printed
ok pdf.ocr huck-finn-scan.pdf -> out.pdf  1 page  3.56s
ok pdf.to-text out.pdf -> out.txt  1442 characters  0.00s
Automatic checks (1)
  • python: code = "assert len(open('out.txt').read().split()) > 50"

a page scanned upside down is read uprightPassed

deft pdf ocr turned.pdf --pages 3 -o out.txt

Input

turned.pdf 75.1 KB · 4 pages
Page 1Page 2Page 3

Output

out.txt 4.5 KB
The LinnSequencer
32 Track MIDI Sequence Recorder

The LinnSequencer is a state-of-the-art composition and performance tool for the professional musician. It is

extremely powerful, yet amazingly simple to learn and use. It’s many remarkable features include:

¢ Operation is similar to multi-track tape recorder with PLAY, STOP, RECORD, FAST
FORWARD, REWIND, and LOCATE controls.

¢ Each of the 100 sequences contains 32 simultaneous, polyphonic tracks. Each track may
be assigned to one of 16 MIDI channels. Simultaneously plays up to 16 polyphonic

synthesizers!

¢ Ultra-fast 3'4” disk drive stores complex songs in seconds and holds over 110,000 notes

per disk!

© One or all tracks may be TRANSPOSED at the touch of a key.
¢ Exclusive real-time ERASE function makes editing FAST.
© Exclusive REPEAT function automatically repeats any held notes at a pre-selected

rhythmic value.

¢ TIMING CORRECTION works during playback and operates without ‘chopping’ notes.

¢ Optional SMPTE time code synchronization.

© Optional remote control.

Recording a Sequence

To record a sequence, simply press RECORD and PLAY,
then play your MIDI keyboard in time to the Sequencer’s
click track. When the sequence loops back around to bar 1,
you'll hear what you played—only all timing errors will be

corrected! (Timing correction may be adjusted or defeated).

Any additional notes played will be added into the track
— existing notes are not erased while recording!

FAST FORWARD, REWIND, and LOCATE controls
may be used at any time to quickly access any location in
your sequence for spot-recording. To overdub a new part,
select a different track and start recording—while you
record, the first track will play in perfect sync (unless you
MUTE it, or SOLO another track). In this way, up to 32
tracks may be overdubbed! All MIDI effects are recorded
including pitch bend, modulation, velocity, aftertouch,
sustain pedal, and program changes!

Editing

To erase a wrong note, simply hold ERASE and press
the note to be erased just before it plays in the sequence—
when played back, it will be gone. Notes may also be

added, erased, or changed using the SINGLE STEP func-
tion. To overdub notes at specific points within a sequence,

Additional Features

simply use LOCATE, FAST FORWARD, or REWIND to
find the desired bar number, then start recording.

The INSERT/COPY function allows you to move bars
from one location to another—in the same sequence or a
different one. For example, you might insert a copy of the
first verse between the second chorus and the bridge.
DELETE BARS operates the same way to remove
unwanted sections,

Creating a Song

One way to create a song is to record each track all the
way through (up to 999 bars). Another way is to record
each basic section (verse, chorus, etc.) in individual
sequences, then use the CREATE SONG function to “chain”
them together. CREATE SONG will then automatically
copy all the parts into a new sequence. If desired, you can
even set the last few
… 1514 more characters
What it printed
ok pdf.ocr turned.pdf -> out.txt  4512 characters  4.49s
Automatic checks (1)
  • text: contains = ["LinnSequencer", "Track MIDI Sequence Recorder"], file = "out.txt"

a scan with a short text stamp is readPassed

deft pdf ocr clipping.pdf -o out.txt

Input

clipping.pdf 58.5 KB · 1 page
Page 1

Output

out.txt 3.0 KB
THE FEDERAL REPORTER.

THE FEDERAL REPORTER. Vol. 1. Cases Argued
and Determined in the Oircult and District Courts
of the United States. March, 1880. PEYTON BOYLE,
Editor. St. Paul: WEST PUBLIsHiING CoMPANy.

Several times in past years we have spoken
of the lack of any satisfactory system for re-
porting the subordinate Federal courts. Until
now this matter bas been, taking the country
at large, in entire confusion. No attention has
been paid to the subject by Government, and
private enterprise has hitherto cared for it
only in the more populous fcireuits and dis-
tricts. Tho Federal Reporter undertakes
to fill this chasm in the judiciel system. Its
engagement is to give immediate publication of
all the current decisions of the Circuit and Dis-
trict Courts, issued every weok, in the ordinary
size and form of State reports, ‘The number of
pages in each issue varies in accordance with
the quantity of matter received, the object
being to giveevery opinion promptly, which
makes some issues large and some small, The
copies of the opinions published are in most
instances supplied by the Clerks of the courts.
The head-notes are propared by the edi-
tor, The present volume is well edited and
printed. ‘The enterprise deserves the approval
and support which we bespoke for if when it
was first announced, and from acknowledg-
ments in the preface of tho ‘ encouraging re-
ception” which the first volume has received.
and trom the further facts that the second
volume is completed in numbers and the pub-
lishers aro even under way with the third, we
infer that a satisfactory support is assured,
and that the publication may be deemed per-
manent. It well deserves some appropriation
by Congress to place the volumes in those pub-
lic offices where early knowledge of the course
of decisions in the national courts is peculiarly
important.

The more notable contents of the first volume
are about 30 decisions in the various branches
of admiralty, covering the most recent ques-
tions as to carriage of goods, seamen’s wages,
collisions, salvage, pilotage, &c.; about 20
cases on bankruptcy and debtors’ assignments,
soveral of which discuss the effect of the repeal
of the Bankrupt law and revival of State
assignment laws; a case on the liability of the
Penusylvania Ruilroad Company for goods de-
stroyed in the Pittsburg riots; the noted Par-
rott case, sustaining the right of the Chinese to
have work and wages, notwithstanding the
prohibitory regulations of the Pacific States; a
decision expounding the Delaware registration
system, which may well win attention from
those who are preparing for tho election this
Fall; 10 or 12 decisions upon rights and liabill-
ties of corporations, especially upon negotiable
bonds; the noted Gommorford case on the de-
livery of lottery correspondence, with an elabo-
rate charge to the jury in another caso, ex-
plaining the same subject, and about two dozen
decisions upon patents and trade-marks.

Ehe New York Eimes

Published: October 2
… 39 more characters
What it printed
ok pdf.ocr clipping.pdf -> out.txt  3037 characters  4.23s
Automatic checks (1)
  • python: code = "t = open('out.txt').read(); assert len(t.split()) > 300 and 'Federal' in t, len(t.split())"

nothing recognised is a warningPassed

It must print no text recognised.

deft pdf ocr letter.pdf --pages 1 -o out.pdf

Input

letter.pdf 956.1 KB · 7 pages
Page 1Page 2Page 3

Output

out.pdf 949.3 KB · 7 pages
Page 1Page 2Page 3
What it printed
ok pdf.ocr letter.pdf -> out.pdf  1 page  1.58s
warning: no text recognised (handwriting, a photo or blank pages?); the output is not searchable

Real-file tasks

Real files and a plain-language job, from the agent benchmark. These are the reference answers, not an agent run.

Make a scan searchablePassed

scan.pdf is a scan with no text. Produce searchable.pdf where the text can be selected and searched.

deft pdf ocr scan.pdf -o searchable.pdf

Input

scan.pdf 444.5 KB · 4 pages
Page 1Page 2Page 3

Output

searchable.pdf 512.3 KB · 4 pages
Page 1Page 2Page 3
Automatic checks (2)
  • pdf_pages: file = "searchable.pdf", pages = 4
  • pdf_text: file = "searchable.pdf", contains = ["BELMONT"]

Send a scan to an accountantPassed

scan.pdf is going to our accountant. Make the text searchable, keep it under 1MB, and protect it with the password hunter2. Save it as for-accountant.pdf.

deft pdf ocr scan.pdf -o searchable.pdf
deft pdf compress searchable.pdf --target-size 1MB -o small.pdf
deft pdf encrypt small.pdf --new-password hunter2 -o for-accountant.pdf

Input

scan.pdf 1.8 MB · 4 pages
Page 1Page 2Page 3

Output

This PDF has no preview: it needs a password or cannot be read.

searchable.pdf 1.9 MB · 4 pages
Page 1Page 2Page 3
small.pdf 453.0 KB · 4 pages
Page 1Page 2Page 3
Automatic checks (3)
  • max_bytes: file = "for-accountant.pdf", bytes = 1048576
  • pdf_encrypted: file = "for-accountant.pdf", encrypted = true
  • pdf_text: file = "for-accountant.pdf", password = "hunter2", contains = ["CORONA"]