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

[Bug] chunking fails on PDFs with one line text #590

Closed
1 of 2 tasks
sujee opened this issue Sep 14, 2024 · 6 comments
Closed
1 of 2 tasks

[Bug] chunking fails on PDFs with one line text #590

sujee opened this issue Sep 14, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@sujee
Copy link
Contributor

sujee commented Sep 14, 2024

Search before asking

  • I searched the issues and found no similar issues.

Component

Transforms/Other

What happened + What you expected to happen

I am trying process very simple PDFs. Each PDF has one line. See attached example.

When I supply 2 PDFs, I expect 2 chunks as output. But I get zero chunks as output.

a1.pdf
b1.pdf

Reproduction script

data and code are here : https://github.com/sujee/data-prep-kit/tree/test-ededupe/test/test-ededupe

Anything else

No response

OS

Ubuntu

Python

3.11.x

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!
@sujee sujee added the bug Something isn't working label Sep 14, 2024
@dolfim-ibm
Copy link
Member

In those documents, the text is detected as Page-footer, which are ignored in the markdown export and chunking.

I don't think we want to change the chunker or exporter for to include footers. This might be resolved with a new layout model, but we don't have yet an eta for it.

@sujee
Copy link
Contributor Author

sujee commented Sep 16, 2024

I am on dev3 release, here is the output for input file a1.pdf.

Does this track with your observation?

{"_name": "",
 "description": {"logs": []},
 "equations": [],
 "figures": [],
 "file-info": {"#-pages": 1,
               "document-hash": "4512df83786d672e062f144a718290982e3a8952c20ddb11014cbb3dcb9b507d",
               "filename": "a1.pdf",
               "page-hashes": [{"hash": "1a75ddf16ddb235368915aed32ab00ccd753838488ec3bb785be9bb84c0d9259",
                                "model": "default",
                                "page": 1}]},
 "footnotes": [],
 "main-text": [{"name": "Text",
                "prov": [{"bbox": [132.78564453,
                                   655.18377686,
                                   251.93409729,
                                   665.57006836],
                          "page": 1,
                          "span": [0, 29]}],
                "text": "Twinkle, twinkle, little star",
                "type": "paragraph"},
               {"name": "Page-footer",
                "prov": [{"bbox": [303.13299561,
                                   87.43224335,
                                   308.11428833,
                                   96.62137604],
                          "page": 1,
                          "span": [0, 1]}],
                "text": "1",
                "type": "page-footer"}],
 "page-dimensions": [{"height": 792.0, "page": 1, "width": 612.0}],
 "page-footers": [],
 "page-headers": [],
 "tables": [],
 "type": "pdf-document"}

@dolfim-ibm
Copy link
Member

Oh right, the footer was actually the page number. This is indeed interesting. We will evaluate it more.

@dolfim-ibm
Copy link
Member

The issue is actually related the text length. The chunker has a parameter for it with default value min_chunk_len=64.

In the new version of the library we actually expose it as a parameter, I think we could easily propagate it as an argument for the DPK transform as well.

@dolfim-ibm
Copy link
Member

The PR #591 will add the option to customize the minimum value.

@sujee
Copy link
Contributor Author

sujee commented Sep 16, 2024

The PR #591 will add the option to customize the minimum value.

very nice 👏

@sujee sujee closed this as completed Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants