From 1c85b6b0c891a1c596d7215cad9a0010def8b5ea Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 21 Mar 2024 13:03:29 +0300 Subject: [PATCH] Update underline text detection parameters --- .../consumers/SemanticDocumentPreprocessingConsumer.java | 4 ++-- .../wcag/algorithms/semanticalgorithms/utils/NodeUtils.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/SemanticDocumentPreprocessingConsumer.java b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/SemanticDocumentPreprocessingConsumer.java index cb5df801..085e31a3 100644 --- a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/SemanticDocumentPreprocessingConsumer.java +++ b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/consumers/SemanticDocumentPreprocessingConsumer.java @@ -112,12 +112,12 @@ private SortedSet 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; diff --git a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/utils/NodeUtils.java b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/utils/NodeUtils.java index 6d7d00c4..b6d1838e 100644 --- a/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/utils/NodeUtils.java +++ b/src/main/java/org/verapdf/wcag/algorithms/semanticalgorithms/utils/NodeUtils.java @@ -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};