some fixes
This commit is contained in:
parent
fda3f1001f
commit
8e7bed8b52
@ -127,6 +127,14 @@ public class ReadingOrderService {
|
||||
zonesPerColumn.forEach(list -> list.sort(Comparator.comparing(BoundingBox::getY, (o1, o2) -> DoubleUtils.compareDouble(o1, o2, THRESHOLD))
|
||||
.thenComparing(BoundingBox::getX, (o1, o2) -> DoubleUtils.compareDouble(o1, o2, THRESHOLD))));
|
||||
|
||||
zonesPerColumn.forEach(list -> list.sort(new Comparator<Zone>() {
|
||||
@Override
|
||||
public int compare(Zone o1, Zone o2) {
|
||||
|
||||
return Math.abs(o1.getMinY() - o2.getMinY()) < 5 && o1.getMinX() < o2.getMinX() == true ? -1 : 0;
|
||||
}
|
||||
}));
|
||||
|
||||
return zonesPerColumn.stream()
|
||||
.flatMap(Collection::stream)
|
||||
.toList();
|
||||
|
||||
@ -130,13 +130,13 @@ public class DocstrumBlockificationService {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (current.intersectsY(previous) && current.horizontalDistance(previous) < 20) {
|
||||
if (current.intersectsY(previous) && current.horizontalDistance(previous) < 50) {
|
||||
previous = combineBlocksAndResetIterator(previous, current, itty, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (areTheOnlyTwoBlocksOnHeightsWithBothMoreThanTwoLines(previous, current, page)) {
|
||||
previous = combineBlocksAndResetIterator(previous, current, itty, true);
|
||||
if (isOnlyIntersectingYAndOnelineOrPrevoiusTwoLines(previous, current, page)) {
|
||||
previous = combineBlocksAndResetIterator(previous, current, itty, previous.isToDuplicate());
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@ public class DocstrumBlockificationService {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (current.getDir() == inner.getDir() && current.intersects(inner, xThreshold, yThreshold)){
|
||||
if (current.getDir() == inner.getDir() && current.intersects(inner, xThreshold, yThreshold)) {
|
||||
|
||||
boolean toDuplicate = current.isToDuplicate() || inner.isToDuplicate();
|
||||
current.getSequences().addAll(inner.getSequences());
|
||||
@ -332,7 +332,8 @@ public class DocstrumBlockificationService {
|
||||
itty.set(current);
|
||||
}
|
||||
}
|
||||
} var blocksIterator = blocks.iterator();
|
||||
}
|
||||
var blocksIterator = blocks.iterator();
|
||||
while (blocksIterator.hasNext()) {
|
||||
if (blocksIterator.next() == null) {
|
||||
blocksIterator.remove();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user