Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced text extraction on columns, tables, equations #38

Open
gunnsth opened this issue Jan 1, 2019 · 12 comments
Open

Advanced text extraction on columns, tables, equations #38

gunnsth opened this issue Jan 1, 2019 · 12 comments
Labels
enhancement New feature or request extract feature New feature

Comments

@gunnsth
Copy link
Contributor

gunnsth commented Jan 1, 2019

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.

@gunnsth gunnsth transferred this issue from unidoc/unidoc May 24, 2019
@gunnsth gunnsth added enhancement New feature or request extract feature New feature labels Jun 2, 2020
@Ben-harder
Copy link

Any update on this? I've found that unfortunately table extraction seems to be about 50% correct at the moment

@gunnsth
Copy link
Contributor Author

gunnsth commented Aug 26, 2020

@Ben-harder Can you post some cases where it falls short? And also the code you are using.

@Ben-harder
Copy link

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:
table_good_1

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.
table_bad_1
2.
table_bad_2
3.
table_bad_3

It also picked up a few numbered lists as well.

@Alttaf
Copy link

Alttaf commented Aug 26, 2020

+1 for this

@gunnsth
Copy link
Contributor Author

gunnsth commented Aug 26, 2020

@Ben-harder Can you share some PDFs that we can use for testing and include in our QA and automated test suites?

@Ben-harder
Copy link

Sure I can give you the one from the images
Speer_Permit.pdf
Speer_Permit_overlay.pdf

@peterwilliams97
Copy link
Contributor

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:

  • Grid line detection fixes a lot of cases
  • Sparse table detection can be tricky
  • Detecting tables without gridlines requires making some judgments

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?

@Ben-harder
Copy link

Hi Peter, thank you that sounds great!

And no, I haven't used any other PDF table extractors.

@Ben-harder
Copy link

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.

Speer_Permit 18WE0486.CP1_Blowdown vent.txt

@peterwilliams97
Copy link
Contributor

Thanks. That will give me a benchmark to compare against.

@Elikrag
Copy link

Elikrag commented Oct 2, 2020

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:

Screenshot from 2020-10-02 16-42-00

Screenshot from 2020-10-02 16-42-22

Along with Ben's 3rd example still not getting fully picked up:

ex3

Seems like table identification improved, but cell identification within a table didn't. Curious if there's any update on this? Thanks!

@gunnsth
Copy link
Contributor Author

gunnsth commented Oct 19, 2020

Table extractions have been improved in v3.13.0 and you should see much better results with your files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request extract feature New feature
Projects
None yet
Development

No branches or pull requests

5 participants