Open gunnsth opened 5 years ago
Any update on this? I've found that unfortunately table extraction seems to be about 50% correct at the moment
@Ben-harder Can you post some cases where it falls short? And also the code you are using.
Sure. We're using v3.9.0
and we're getting the pageText object for each page and then I've iterated through pageText.Tables()
and drawn out the cell bbox's in blue and their bbox's unioned in red to represent the whole table. You can ignore the green outlines.
Here's an example of what we want with one of the tables it picked up perfectly:
And here are some examples of where it either picks up lists and thinks they're tables, or it misses some cells in an actual table: 1. 2. 3.
It also picked up a few numbered lists as well.
+1 for this
@Ben-harder Can you share some PDFs that we can use for testing and include in our QA and automated test suites?
Sure I can give you the one from the images Speer_Permit.pdf Speer_Permit_overlay.pdf
Ben, I will investigate this. I have am working on a few versions of table extraction code that I have not submitted yet. They address most/all of the issues you raise but they make other trade-offs so have been holding them back.
Some of the things I am working on are:
I will see if I can make a small commit that addresses your specific issues next week. Have you been using any other PDF table extractors? If so, can you tell me which one does the best job on you files?
Hi Peter, thank you that sounds great!
And no, I haven't used any other PDF table extractors.
So we actually have used AWS Textract, my bad. The results from it on the same document are attached. It's a JSON file, just had to convert it so GitHub would let me upload it.
Thanks. That will give me a benchmark to compare against.
Following up on the examples @Ben-harder posted. Examples 1 and 2 are fixed from v3.11.1, but the issue with 3 remains. Here's two more examples from the same PDF:
Along with Ben's 3rd example still not getting fully picked up:
Seems like table identification improved, but cell identification within a table didn't. Curious if there's any update on this? Thanks!
Table extractions have been improved in v3.13.0 and you should see much better results with your files.
To properly extract certain text in PDF, it may be necessary to detect/group lines, identify tables, equations. This may either be done post-extraction of objects or before, depending on what is easier to implement and gives good results.
Also need to assemble a solid corpus for testing, as well as an API prototyping. Tabular extraction may need a different approach than equations and possibly a different API.
At this point we are collecting input so that we can define this issue better.