Make block distance dynamic in multi-columns articles #1288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is a piece of code:
https://github.com/kermitt2/grobid/blob/92ea31edc391c56f6fd1eab61a16aaab5fda960c/grobid-core/src/main/java/org/grobid/core/document/Document.java#L1276
that decided whether blocks around a figure caption (something starting with fig, and tagged as
<figure>is "close" enough to it (15px fixed distance) so that consider it or not as part of the figure. Before #1266, certain part of the document were discarded, however now are added as paragraphs.Now, this works in many cases, but it relies on the fact that the blocks distance is consistent.
in this article, for example, the figure caption blocks are correctly recognized:
Figure 1 is correctly assembled:
Figure 2 is not, because the blocks dimensions are too "far" (15.16px > 15px):
By looking at few examples, if
andends near the column, it will make the block larger, and therefore, close to the other...I did relax the rule of the 15px when the two blocks are at the same height, but is not a solution that will cover all cases.
any comment is welcome 😄