RED-6945: Generate simplified text with linebreaks

This commit is contained in:
deiflaender 2023-06-20 16:09:37 +02:00
parent ada5df0048
commit c3b2f9d39f
3 changed files with 3 additions and 3 deletions

View File

@ -259,7 +259,7 @@ public class SearchableText {
sb.append(word.toString()); sb.append(word.toString());
previous = word; previous = word;
} }
return sb.append("\n").toString(); return TextNormalizationUtilities.removeHyphenLineBreaks(sb.toString());
} }
} }

View File

@ -367,7 +367,7 @@ public class AnalyzeService {
if (text != null) { if (text != null) {
numberOfPages = text.getNumberOfPages(); numberOfPages = text.getNumberOfPages();
text.getSectionTexts().stream().filter(Objects::nonNull).forEach(st -> sectionTexts.add(new SimplifiedSectionText(st.getSectionNumber(), st.getText()))); text.getSectionTexts().stream().filter(Objects::nonNull).forEach(st -> sectionTexts.add(new SimplifiedSectionText(st.getSectionNumber(), st.getSearchableText().getAsStringWithLinebreaks())));
} }
return SimplifiedText.builder().numberOfPages(numberOfPages).sectionTexts(sectionTexts).build(); return SimplifiedText.builder().numberOfPages(numberOfPages).sectionTexts(sectionTexts).build();
} }

View File

@ -364,7 +364,7 @@ public class RedactionIntegrationTest {
@Test @Test
public void titleExtraction() throws IOException { public void titleExtraction() throws IOException {
AnalyzeRequest request = prepareStorage("files/new/APN3_Clean_6.1 (6.4.3.01-02)_Apple_211029.pdf"); AnalyzeRequest request = prepareStorage("files/Metolachlor/S-Metolachlor_RAR_01_Volume_1_2018-09-06.pdf");
analyzeService.analyzeDocumentStructure(new StructureAnalyzeRequest(request.getDossierId(), request.getFileId())); analyzeService.analyzeDocumentStructure(new StructureAnalyzeRequest(request.getDossierId(), request.getFileId()));
AnalyzeResult result = analyzeService.analyze(request); AnalyzeResult result = analyzeService.analyze(request);