Merge branch 'DM-285' into 'master'

DM-285: fix betweenTextRanges

Closes DM-285

See merge request redactmanager/redaction-service!135
This commit is contained in:
Ali Oezyetimoglu 2023-09-19 15:18:12 +02:00
commit 6031d7c576
3 changed files with 4 additions and 3 deletions

View File

@ -208,7 +208,7 @@ public class EntityCreationService {
.filter(stopBoundary -> stopBoundary.start() > startTextRange.end()) .filter(stopBoundary -> stopBoundary.start() > startTextRange.end())
.min(Comparator.comparingInt(TextRange::start)); .min(Comparator.comparingInt(TextRange::start));
if (optionalStopTextRangeWithMinimalDistance.isEmpty()) { if (optionalStopTextRangeWithMinimalDistance.isEmpty()) {
break; continue;
} }
entityBoundaries.add(new TextRange(startTextRange.end(), optionalStopTextRangeWithMinimalDistance.get().start())); entityBoundaries.add(new TextRange(startTextRange.end(), optionalStopTextRangeWithMinimalDistance.get().start()));
} }
@ -223,7 +223,8 @@ public class EntityCreationService {
For Example consider the text: "a this is some text. a here is more text b". If "a" is the start string and "b" is the stop string, there are two possibilities. For Example consider the text: "a this is some text. a here is more text b". If "a" is the start string and "b" is the stop string, there are two possibilities.
"this is some text. a here is more text" and "here is more text". We only want to keep the latter. "this is some text. a here is more text" and "here is more text". We only want to keep the latter.
*/ */
return entityTextRanges.stream().filter(boundary -> entityTextRanges.stream().noneMatch(innerBoundary -> innerBoundary != boundary && innerBoundary.containedBy(boundary))) return entityTextRanges.stream()
.filter(boundary -> entityTextRanges.stream().noneMatch(innerBoundary -> !innerBoundary.equals(boundary) && innerBoundary.containedBy(boundary)))
.toList(); .toList();
} }

View File

@ -48,7 +48,7 @@ public class DocumineFloraTest extends AbstractRedactionIntegrationTest {
// @Disabled // @Disabled
public void titleExtraction() throws IOException { public void titleExtraction() throws IOException {
AnalyzeRequest request = uploadFileToStorage("files/Documine/Flora/ProblemDocs/8.SYN524464 FS (A16148F) - Teste de Ames (1).pdf"); AnalyzeRequest request = uploadFileToStorage("files/Documine/Flora/_000008810-0.2.pdf");
// AnalyzeRequest request = prepareStorage("files/Documine/Flora/ProblemDocs/SOLICITA_VICTRATO-GOLD-II_Item 21_Mutacao_Genica (1).pdf", // AnalyzeRequest request = prepareStorage("files/Documine/Flora/ProblemDocs/SOLICITA_VICTRATO-GOLD-II_Item 21_Mutacao_Genica (1).pdf",
// "files/Documine/Flora/ProblemDocs/SOLICITA_VICTRATO-GOLD-II_Item 21_Mutacao_Genica (1).TABLES.json"); // "files/Documine/Flora/ProblemDocs/SOLICITA_VICTRATO-GOLD-II_Item 21_Mutacao_Genica (1).TABLES.json");