Package com.itextpdf.pdf2data.ocr.engine
Class Pdf2DataTATRPostProcessorStaticInitializer
java.lang.Object
com.itextpdf.pdf2data.ocr.engine.Pdf2DataTATRPostProcessorStaticInitializer
Class for Microsoft TATR models initializing. These models will be used for
Pdf2DataTATRPostProcessor
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ai.djl.inference.Predictor
List >> Creates newPredictor
for table detection model.static ai.djl.inference.Predictor
List >> Creates newPredictor
for table structure model.static void
initializeStaticModels
(File tableDetectionModel, File tableStructureModel) Initialize models for table post-processing.static boolean
Checks whether TATR post-preprocessing was enabled or not.static void
Close all table models related resources.
-
Method Details
-
initializeStaticModels
Initialize models for table post-processing. Note thatPdf2DataTATRPostProcessor
will be only created and used afterward if you provide both models file. If any of arguments is null thanPdf2DataTATRPostProcessor
will be disabled. -
getTableDetectionPredictor
Creates newPredictor
for table detection model. Note that predictor isn't thread safe, you should create new predictor for each TATR post-processing.- Returns:
-
Predictor
for table detection model
-
getTableStructurePredictor
Creates newPredictor
for table structure model. Note that predictor isn't thread safe, you should create new predictor for each TATR post-processing.- Returns:
-
Predictor
for table structure model
-
isInitialized
public static boolean isInitialized()Checks whether TATR post-preprocessing was enabled or not.- Returns:
-
true
if TATR post-preprocessing is enabled,false
otherwise
-
unloadModels
public static void unloadModels()Close all table models related resources.
-