This commit is contained in:
lmaldacker 2021-02-25 11:49:15 +01:00
parent e188f8a1f6
commit ab031a1d30
2 changed files with 44 additions and 1 deletions

View File

@ -60,15 +60,25 @@ public class RedactionController implements RedactionResource {
Document classifiedDoc = pdfSegmentationService.parseDocument(pdDocument); Document classifiedDoc = pdfSegmentationService.parseDocument(pdDocument);
log.info("Document structure analysis successful, starting redaction analysis..."); log.info("Document structure analysis successful, starting redaction analysis...");
long current = System.currentTimeMillis() - startTime;
long untilNow = current;
log.info("Document classification took: {}.", current);
entityRedactionService.processDocument(classifiedDoc, analyzeRequest.getRuleSetId(), analyzeRequest.getManualRedactions()); entityRedactionService.processDocument(classifiedDoc, analyzeRequest.getRuleSetId(), analyzeRequest.getManualRedactions());
current = System.currentTimeMillis() - startTime - untilNow;
untilNow = untilNow + current;
log.info("Entity redaction took: {}.", current);
redactionLogCreatorService.createRedactionLog(classifiedDoc, pdDocument.getNumberOfPages(), analyzeRequest.getManualRedactions(), analyzeRequest redactionLogCreatorService.createRedactionLog(classifiedDoc, pdDocument.getNumberOfPages(), analyzeRequest.getManualRedactions(), analyzeRequest
.getRuleSetId()); .getRuleSetId());
current = System.currentTimeMillis() - startTime - untilNow;
log.info("Redaction log creation took: {}.", current);
log.info("Redaction analysis successful..."); log.info("Redaction analysis successful...");
log.debug("Finishing redaction analysis took: {}.", System.currentTimeMillis() - startTime); log.debug("Finishing redaction analysis took: {}.", System.currentTimeMillis() - startTime);
return AnalyzeResult.builder() return AnalyzeResult.builder()
.sectionGrid(classifiedDoc.getSectionGrid()) .sectionGrid(classifiedDoc.getSectionGrid())
.redactionLog(new RedactionLog(classifiedDoc.getRedactionLogEntities(), classifiedDoc.getDictionaryVersion(), classifiedDoc .redactionLog(new RedactionLog(classifiedDoc.getRedactionLogEntities(), classifiedDoc.getDictionaryVersion(), classifiedDoc

View File

@ -41,6 +41,8 @@ public class PdfSegmentationService {
log.info("Parsing document..."); log.info("Parsing document...");
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
long current = System.currentTimeMillis() - startTime;
long untilNow = current;
Document document = new Document(); Document document = new Document();
@ -76,24 +78,55 @@ public class PdfSegmentationService {
.getVertical()); .getVertical());
page.setRotation(rotation); page.setRotation(rotation);
current = System.currentTimeMillis() - startTime - untilNow;
untilNow = untilNow + current;
log.info("Preparing page took: {}.", current);
tableExtractionService.extractTables(cleanRulings, page); tableExtractionService.extractTables(cleanRulings, page);
current = System.currentTimeMillis() - startTime - untilNow;
untilNow = untilNow + current;
log.info("Extracting tables from page took: {}.", current);
buildPageStatistics(page); buildPageStatistics(page);
current = System.currentTimeMillis() - startTime - untilNow;
untilNow = untilNow + current;
log.info("Building statistics for page took: {}.", current);
page.setLandscape(parsedElements.isLandscape() || parsedElements.isRotated()); page.setLandscape(parsedElements.isLandscape() || parsedElements.isRotated());
page.setPageNumber(pageNumber); page.setPageNumber(pageNumber);
increaseDocumentStatistics(page, document); increaseDocumentStatistics(page, document);
current = System.currentTimeMillis() - startTime - untilNow;
untilNow = untilNow + current;
log.info("Increasing statistics for page took: {}.", current);
page.setImageBounds(parsedElements.getImageBounds()); page.setImageBounds(parsedElements.getImageBounds());
pages.add(page); pages.add(page);
current = System.currentTimeMillis() - startTime - untilNow;
untilNow = untilNow + current;
log.info("Adding page took: {}.", current);
} }
document.setPages(pages); document.setPages(pages);
current = System.currentTimeMillis() - startTime - untilNow;
untilNow = untilNow + current;
log.info("Setting pages took: {}.", current);
classificationService.classifyDocument(document); classificationService.classifyDocument(document);
current = System.currentTimeMillis() - startTime - untilNow;
untilNow = untilNow + current;
log.info("Classifying took: {}.", current);
sectionsBuilderService.buildSections(document); sectionsBuilderService.buildSections(document);
current = System.currentTimeMillis() - startTime - untilNow;
log.info("Building sections took: {}.", current);
log.info("Finishing document parsing took: {}.", System.currentTimeMillis() - startTime); log.info("Finishing document parsing took: {}.", System.currentTimeMillis() - startTime);
return document; return document;