RED-8642: Use LineMode from cv-analysis-service instead of table cell mode

This commit is contained in:
maverickstuder 2024-03-11 12:09:37 +01:00
parent 86addc3139
commit d84bda6e5e
2 changed files with 9 additions and 7 deletions

View File

@ -34,7 +34,6 @@ public class RulingCleaningService {
Rulings verticalAndHorizontalRulingLines;
// todo 8642: set cv parsed only when no rulings exist or just always add them?
if (rulings.isEmpty() && parsedRulings != null) {
verticalAndHorizontalRulingLines = extractVerticalAndHorizontalRulingLines(parsedRulings);
} else {

View File

@ -41,23 +41,24 @@ public class ViewerDocumentTest extends BuildDocumentTest {
@Test
@Disabled
//@Disabled
@SneakyThrows
public void testViewerDocumentWithTables() {
String fileName = "files/cv_tables/brokenTablesOnOcr_ocred.pdf";
String tableFileName = "files/cv_tables/brokenTablesOnOcr_ocred.TABLES.json";
String tmpFileName = "/tmp/" + Path.of(fileName).getFileName() + "_VIEWER.pdf";
String fileName = "files/cv_tables/VV-331340-first100.pdf";
String tableFileName = "files/cv_tables/VV-331340-first100.TABLES.json";
Path path = Path.of(fileName);
String tmpFileName = "/tmp/" + path.getFileName() + "_VIEWER.pdf";
var mapper = ObjectMapperFactory.create();
var tableResponse = mapper.readValue(new ClassPathResource(tableFileName).getInputStream(), TableServiceResponse.class);
var documentFile = new ClassPathResource(fileName).getFile();
var classificationDocument = layoutParsingPipeline.parseLayout(LayoutParsingType.DOCUMINE,
var classificationDocument = layoutParsingPipeline.parseLayout(LayoutParsingType.REDACT_MANAGER,
documentFile,
new ImageServiceResponse(),
tableResponse,
new VisualLayoutParsingResponse(),Path.of(fileName).getFileName().toFile().toString());
new VisualLayoutParsingResponse(), path.getFileName().toFile().toString());
ViewerDocumentService viewerDocumentService = new ViewerDocumentService(null);
LayoutGridService layoutGridService = new LayoutGridService(viewerDocumentService);
Document document = DocumentGraphFactory.buildDocumentGraph(classificationDocument);
@ -65,5 +66,7 @@ public class ViewerDocumentTest extends BuildDocumentTest {
layoutGridService.addLayoutGrid(documentFile, document, new File(tmpFileName), true);
}
}