Compare commits

...
Author SHA1 Message Date
Kilian Schüttler 25929cfe2f Merge branch 'RM-231-bp-bp' into 'release/0.159.x'
RM-231: missing whitespace in name

See merge request fforesight/layout-parser!265
2025-01-14 13:05:03 +01:00
Kilian Schuettler b447788fcb RM-231: missing whitespace in name 2025-01-14 13:00:00 +01:00
Kilian Schüttler 65671d6f25 Merge branch 'RED-10714-bp-bp' into 'release/0.159.x'
RED-10714: fix IndexOutOfBoundsException

See merge request fforesight/layout-parser!260
2025-01-10 12:33:14 +01:00
Kilian Schuettler 3ef0d9eccd RED-10714: fix IndexOutOfBoundsException 2025-01-10 12:10:35 +01:00
2 changed files with 7 additions and 1 deletions
@@ -24,7 +24,7 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false)
public class Line extends TextBoundingBox {
private static final double WORD_DISTANCE_MULTIPLIER = 0.18;
private static final double WORD_DISTANCE_MULTIPLIER = 0.17;
@EqualsAndHashCode.Include
private final double x0;
@@ -159,6 +159,9 @@ public class Line extends TextBoundingBox {
private void computeWords(double wordSpacing) {
// Imo, the width of space should be scaled with the font size, but it only depends on the median distance between horizontal neighbours.
// If there are large differences in fontsize on a page, this might lead to missing spaces for the smaller fonts and too many for larger fonts.
// I've just now changed the scaling factor. If you come across this comment with missing whitespaces again, try scaling the fontsize instead of simply changing the factor again.
Word word = new Word();
Character previous = null;
for (Character current : characters) {
@@ -71,6 +71,9 @@ public class TableOfContentsClassificationService {
private int identifyTOCItems(int start, List<TextBlockOnPage> textBlocks, ClassificationDocument document) {
if (start >= textBlocks.size()) {
return start;
}
ClassificationPage startPage = textBlocks.get(start).page();
List<TextBlockOnPage> initialLookAhead = textBlocks.subList(start, Math.min(start + SURROUNDING_BLOCKS_RADIUS, textBlocks.size()));
HashMap<NumberWord, TextBlockOnPage> numberToBlockLookup = new HashMap<>();