Remix.run Logo
Lightweight, highly accurate line and paragraph detection(arxiv.org)
124 points by colonCapitalDee 15 hours ago | 20 comments
JKCalhoun 13 hours ago | parent | next [-]

Interesting. Two engineers at Apple worked on something similar that would slurp character bounding boxes from a PDF page and reconstruct paragraphs, columns, tables, etc.

It was surfaced in iOS a decade ago as "tap to zoom" feature for PDFs. It's funny — as with a lot of things there was a lot of sophisticated engineering under the hood and then marketing simply wants it to detect a tap in a paragraph and zoom to its bounds.

I can't think of the last time I read a PDF on my phone or I would test it to see if it still works as I remember.

herodotus 8 hours ago | parent | next [-]

One of those engineers came up with idea of using cluster analysis for word grouping. The other engineer realized that we had a k-cluster problem in the general case, but needed to figure out what k was. (In the simplest case it is 2 - letter gaps and word gaps). They used the differences between the anchor points of glyphs.

NoPicklez 9 hours ago | parent | prev | next [-]

I think we're thinking the same thing, but this is one of those little features on modern smartphones that we used to take for granted. Being table to tap to zoom on a document and have it snap to the right spot was a big feature improvement, now we expect it.

msarnoff 4 hours ago | parent | prev | next [-]

I was there when we added it to Preview ;) I think Nils wrote the code to hook it up, because he also worked on the loupe and how it would automatically lock onto the bounding box of a line.

herodotus 5 hours ago | parent | prev | next [-]

I can confirm that tap to zoom and word higlight still works on many PDFs. PDF documents are so varied in structure that it is impossible to say that any technique always works.

weinzierl 3 hours ago | parent | prev | next [-]

I often find myself making a screenshot and copy pasting from the image because selection in many apps is so broken. Especially for PDF, the iOS viewer has completely useless selection.

el_benhameen 12 hours ago | parent | prev | next [-]

Wow, I had no idea. That’s pretty cool. I don’t read a ton of pdfs on my phone, but I always find it super frustrating when that functionality is missing somewhere else.

msephton 5 hours ago | parent | prev [-]

Not just PDFs, you can also do the same thing (double tap to zoom to a paragraph) in Safari on any web page.

mcswell 11 hours ago | parent | prev | next [-]

An interesting problem, particularly with handwritten documents. And not limited to what they worked on, from their conclusion: "...the number of clustering levels is not limited to two, since document layout tasks are extremely diverse in nature. Paragraphs can further be clustered into text columns or sections, which may belong to even higher level blocks. Figure 16 shows a physical paragraph, or part of a semantic paragraph which spans across multiple text columns..." Not to mention text wrapping around figures.

The general field is called "document structure analysis" or "document layout analysis." There's been lots of work--at a cursory glance at this article, I'm not sure they've discussed that literature.

I worked on a similar problem a decade or so, although our work was done mostly by hand. We were trying to not only read in (bilingual) dictionaries using OCR, but turn them into dictionary entries, and then parse each entry into its parts (headword, part of speech, definitions or glosses, example sentences, subentries...). I won't go into details, but to our surprise one of the most difficult parts for the machine to get right was recognizing bold or italicized text.

herodotus 5 hours ago | parent [-]

See (as one of several patents about this): https://ppubs.uspto.gov/api/patents/html/7899826?source=USPA...

alsetmusic 11 hours ago | parent | prev | next [-]

Only two weeks ago, I was trying to save an online-only book of 24 chapters. The text is filled with images to help illustrate and contextualize the content. I individually saved each chapter as PDFs and ran a few different command line tools to try to extract the contents to plain text. They all came out badly disjointed. Even tools that were meant to do what this paper describes failed miserably at reconstructing naturally flowing text.

While this isn't something I need on a regular basis, it's timely news to hear about someone making progress on what seems like it ought to be a straightforward problem to solve. As the results of my efforts show, it must not be nearly as simple as one might expect.

jimmySixDOF 7 hours ago | parent | next [-]

Docling from IBM and Markitdown from Microsoft are reasonably reliable if you didn't try them also take the extra step to get image summaries in plain text from a VLM it's useful of you want to feed final results to an LLM later. Or first try to skip all that with jina.reader or firecrawl llmstxt they will extract directly from the website so simple but sometimes it works sometimes it doesn't.

Hnrobert42 9 hours ago | parent | prev [-]

You could try splitting the book into 1 page PDFs. Send to Gemini flash 2.5 and ask it to OCR to markdown format. It's about USD $0.006/page. It works well for one of my clients.

msephton 4 hours ago | parent | prev | next [-]

Dupe: https://news.ycombinator.com/item?id=45323027

foofoo12 3 hours ago | parent [-]

HN title doesn't match the link or the comments? Dang?

VeejayRampay 39 minutes ago | parent | prev | next [-]

remotely related, but I have yet to find a solution for page classification in a document for tables, i.e. a classifier that returns the index of pages containing tables in a document that is reliable

solutions using things like img2table or pymupdf are really bad (pymupdf is not even reliable for text pdfs)

throwaway81523 13 hours ago | parent | prev | next [-]

2022, and we need this in browser reader modes.

HocusLocus 10 hours ago | parent | prev | next [-]

If you are a fan of irony, the paper is also available in PDF format.

JohnKemeny 4 hours ago | parent [-]

It's like rai-ain, on your wedding day.

kalev 10 hours ago | parent | prev [-]

Would this be of help with YouTubes auto-generated subtitles? I hate the fact the words appear just in time one by one, unlike traditional complete sentences that appear fully one at a time.