Dr. Liz Fischer Profile picture
Jun 23, 2022 11 tweets 4 min read Read on X
This is the part of my dissertation I've been working on for the last couple of months! It's a tool to help split PDF-bound documents (so far, mostly scans of printed books) into "units of interest." I want to share bc I'm pretty dang proud of it 🥰 Image
Ok, so pretend you have a library catalog with entries (this is literally just one of my case studies, but hey). You scan a whole printed catalog of books, and you want to study that as a corpus, but first you have to chop it up. You need each book's info as its own "document"
Your OCR engine is... meh, or your scans are not ideal for it, and using regular expressions to split the text up leads to a *lot* of time spent correct. How do I know? I experienced it last year with students on Atlas of a Medieval Life. The spreadsheet was a nightmare. Image
Turns out, though, that most printed books use *whitespace* of different sizes, or things intruding into whitespace, to communicate structure to our little people brains! *I* don't look at this page and know its structure by the words, I know from the gaps. Image
Wouldn't it be great, I thought, if I could ask my computer to think in the same way about the page. If *I* segment these entries using page layout, so should it. But turns out that's not a thing there are lots of tools for! So....
I talked about this on here a bit before & some folks immediately turned their minds to machine learning. And while this would be cool as an ML problem, I'm on one hell of a clock with this dissertation. If we waited to do the ML solution for everything, we'd get nowhere!
My little system is dumb, but it's a good listener. It lets you make rules about whitespace-- how wide a gap, how much "stuff" in a line for it to count as truly "blank"-- and use that to separate entries instead/in addition to regex on the OCR'd text. Image
You can play around with the settings to see what gives you the breaks you want, and what will specify the stuff you want to ignore. The settings on the left give the break between entries I want, while the settings on the right can help me ignore the header and page number.
Image
Image
At the end, I can edit the entry breaks (split/join/delete), correct OCR if needed or desired (including find/replace), and indicate a name/id for each entry (with a keyboard shortcut to copy the ID from highlighted portion of the body text & remove extra spaces) Image
It's not totally done & bug tested, and it certainly isn't well documented yet. But it will eventually be available as a Docker image you can grab & run on your own computer! In the meantime, if you know of other tools, or people doing similar work, I'd love to know!
@threadreaderapp unroll

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Dr. Liz Fischer

Dr. Liz Fischer Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(