RED-7679: WIP: Added Table Demo rules according to given examples in pdf

This commit is contained in:
Ali Oezyetimoglu 2023-10-25 12:49:22 +02:00
parent 1b6d8d31c4
commit 59c6ca3b5d
2 changed files with 2 additions and 8 deletions

View File

@ -216,8 +216,6 @@ public class EntityCreationService {
public Stream<TextEntity> betweenRegexes(String regexStart, String regexStop, String type, EntityType entityType, SemanticNode node) {
checkIfBothStartAndEndAreEmpty(regexStart, regexStop);
TextBlock textBlock = node.getTextBlock();
List<TextRange> startBoundaries = RedactionSearchUtility.findTextRangesByRegex(regexStart, textBlock);
List<TextRange> stopBoundaries = RedactionSearchUtility.findTextRangesByRegex(regexStop, textBlock);
@ -228,8 +226,6 @@ public class EntityCreationService {
public Stream<TextEntity> betweenRegexesIgnoreCase(String regexStart, String regexStop, String type, EntityType entityType, SemanticNode node) {
checkIfBothStartAndEndAreEmpty(regexStart, regexStop);
TextBlock textBlock = node.getTextBlock();
List<TextRange> startBoundaries = RedactionSearchUtility.findTextRangesByRegexIgnoreCase(regexStart, 0, textBlock);
List<TextRange> stopBoundaries = RedactionSearchUtility.findTextRangesByRegexIgnoreCase(regexStop, 0, textBlock);
@ -239,16 +235,12 @@ public class EntityCreationService {
public Stream<TextEntity> betweenTextRanges(List<TextRange> startBoundaries, List<TextRange> stopBoundaries, String type, EntityType entityType, SemanticNode node) {
checkIfBothStartAndEndAreEmpty(startBoundaries, stopBoundaries);
return betweenTextRanges(startBoundaries, stopBoundaries, type, entityType, node,0);
}
public Stream<TextEntity> betweenTextRanges(List<TextRange> startBoundaries, List<TextRange> stopBoundaries, String type, EntityType entityType, SemanticNode node, int limit) {
checkIfBothStartAndEndAreEmpty(startBoundaries, stopBoundaries);
List<TextRange> entityBoundaries = findNonOverlappingBoundariesBetweenBoundariesWithMinimalDistances(startBoundaries, stopBoundaries);
return entityBoundaries.stream()
.filter(range -> (limit == 0 || range.length() <= limit))

View File

@ -8,6 +8,7 @@ import java.io.IOException;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -47,6 +48,7 @@ public class AnalysisTest extends AbstractRedactionIntegrationTest {
@Test
@Disabled
public void analyzeTableDemoFile() {
AnalyzeRequest request = uploadFileToStorage("files/TableDemo/Table_examples.pdf");