Class TesseractHelper


  • public class TesseractHelper
    extends Object
    Helper class for locale setup (see ISO 639).
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Method Detail

      • isModified

        public boolean isModified()
        Whether the settings got modified.
        Returns:
        true if modified
      • getExecutable

        public String getExecutable()
        Returns the executable.
        Returns:
        the executable
      • setExecutable

        public void setExecutable​(String value)
        Updates the executable.
        Parameters:
        value - the executable
      • getLanguage

        public TesseractLanguage getLanguage()
        Returns the language.
        Returns:
        the language
      • setLanguage

        public void setLanguage​(TesseractLanguage value)
        Updates the language.
        Parameters:
        value - the language
      • reload

        public void reload()
        Reloads the properties file. Discards any unsaved settings.
      • save

        public boolean save()
        Saves the settings in the user's home directory.
        Returns:
        true if successfully saved
      • getCommand

        public String[] getCommand​(String input,
                                   String outputbase,
                                   PlaceholderFile config)
        Assembles the tesseract command for the given input/output. Uses default values for executable, language and page segmentation, output in ASCII.
        Parameters:
        input - the input file to process
        outputbase - the output base to use
        config - the config file, null or directory to ignore
        Returns:
        the command
      • getCommand

        public String[] getCommand​(String exe,
                                   String input,
                                   String outputbase,
                                   TesseractLanguage lang,
                                   TesseractPageSegmentation seg,
                                   PlaceholderFile config,
                                   boolean hocr)
        Assembles the tesseract command for the given input/output.
        Parameters:
        exe - the executable, null to use default
        input - the input file to process
        outputbase - the output base to use
        lang - the language to use, null to use default
        seg - the page segemention, null to use default
        config - the config file, null or directory to ignore
        hocr - whether to output in hOCR format instead of ASCII
        Returns:
        the command
      • getSingleton

        public static TesseractHelper getSingleton()
        Returns the singleton.
        Returns:
        the singleton