Class Pdf2DataTATRPostProcessorStaticInitializer

java.lang.Object
com.itextpdf.pdf2data.ocr.engine.Pdf2DataTATRPostProcessorStaticInitializer

public final class Pdf2DataTATRPostProcessorStaticInitializer extends Object
Class for Microsoft TATR models initializing. These models will be used for Pdf2DataTATRPostProcessor.
  • Method Details

    • initializeStaticModels

      public static void initializeStaticModels (File tableDetectionModel, File tableStructureModel)
      Initialize models for table post-processing. Note that Pdf2DataTATRPostProcessor will be only created and used afterward if you provide both models file. If any of arguments is null than Pdf2DataTATRPostProcessor will be disabled.
      Parameters:
      tableDetectionModel - path to your table detection model as File
      tableStructureModel - path to your table structure model as File
    • getTableDetectionPredictor

      public static ai.djl.inference.PredictorList>> getTableDetectionPredictor()
      Creates new Predictor 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

      public static ai.djl.inference.PredictorList>> getTableStructurePredictor()
      Creates new Predictor 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.