Skip to content

Commit

Permalink
Update underline text detection parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Mar 28, 2024
1 parent f347364 commit 1c85b6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ private SortedSet<LineChunk> getHorizontalLines(TextChunk textChunk) {
-Double.MAX_VALUE, textChunk.getBaseLine()),
new LineChunk(textChunk.getPageNumber(), Double.MAX_VALUE,
textChunk.getBaseLine() - NodeUtils.UNDERLINED_TEXT_EPSILONS[1] * textChunk.getBoundingBox().getHeight(), Double.MAX_VALUE,
textChunk.getBaseLine() - NodeUtils.UNDERLINED_TEXT_EPSILONS[2] * textChunk.getBoundingBox().getHeight()));
textChunk.getBaseLine() - NodeUtils.UNDERLINED_TEXT_EPSILONS[1] * textChunk.getBoundingBox().getHeight()));
}

private boolean isUnderlinedText(TextChunk textChunk, LineChunk lineChunk) {
if (NodeUtils.areOverlapping(textChunk, lineChunk) &&
(lineChunk.getWidth() < NodeUtils.UNDERLINED_TEXT_EPSILONS[3] * textChunk.getBoundingBox().getHeight())) {
(lineChunk.getWidth() < NodeUtils.UNDERLINED_TEXT_EPSILONS[2] * textChunk.getBoundingBox().getHeight())) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class NodeUtils {

public static final double EPSILON = 0.0001;
public static final double TABLE_BORDER_EPSILON = 0.011;
public static final double[] UNDERLINED_TEXT_EPSILONS = {0.08, 0.3, 0.3, 0.3};
public static final double[] UNDERLINED_TEXT_EPSILONS = {0.08, 0.35, 0.3};
private static final double[] HEADING_PROBABILITY_PARAMS = {0.3, 0.0291, 0.15, 0.27, 0.1, 0.25, 0.2, 0.5, 0.05, 0.1};
private static final double[] HEADING_PROBABILITY_PARAMS_SAME_FONT = {0.55, 0.15, 0.55, 0.4, 0.5, 0.15};
private static final double[] HEADING_PROBABILITY_PARAMS_DIFF_FONT = {0.44, 0.1, 0.4, 0.23, 0.35, 0.1};
Expand Down

0 comments on commit 1c85b6b

Please sign in to comment.