Package adams.data.tesseract
Class TesseractHelper
- java.lang.Object
-
- adams.data.tesseract.TesseractHelper
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXECUTABLE
the executable to use.static String
FILENAME
the props file.static String
LANGUAGE
the language to use.protected boolean
m_Modified
whether the settings got modified.protected Properties
m_Properties
the properties.protected static TesseractHelper
m_Singleton
the singleton.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getCommand(String input, String outputbase, PlaceholderFile config)
Assembles the tesseract command for the given input/output.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.String
getExecutable()
Returns the executable.TesseractLanguage
getLanguage()
Returns the language.static TesseractHelper
getSingleton()
Returns the singleton.boolean
isModified()
Whether the settings got modified.void
reload()
Reloads the properties file.boolean
save()
Saves the settings in the user's home directory.void
setExecutable(String value)
Updates the executable.void
setLanguage(TesseractLanguage value)
Updates the language.
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the props file.- See Also:
- Constant Field Values
-
EXECUTABLE
public static final String EXECUTABLE
the executable to use.- See Also:
- Constant Field Values
-
LANGUAGE
public static final String LANGUAGE
the language to use.- See Also:
- Constant Field Values
-
m_Singleton
protected static TesseractHelper m_Singleton
the singleton.
-
m_Properties
protected Properties m_Properties
the properties.
-
m_Modified
protected boolean m_Modified
whether the settings got modified.
-
-
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 processoutputbase
- the output base to useconfig
- 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 defaultinput
- the input file to processoutputbase
- the output base to uselang
- the language to use, null to use defaultseg
- the page segemention, null to use defaultconfig
- the config file, null or directory to ignorehocr
- whether to output in hOCR format instead of ASCII- Returns:
- the command
-
getSingleton
public static TesseractHelper getSingleton()
Returns the singleton.- Returns:
- the singleton
-
-