ReadConfigFile: Read a Tesseract Variable Configuration File

View source: R/ext.R

ReadConfigFileR Documentation

Read a Tesseract Variable Configuration File

Description

This function finds and reads a tesseract configuration file that specifies one or more variable value pairs per line. This can be a convenient way to set multiple variables.

Usage

ReadConfigFile(api, files, debug = FALSE, ok = FALSE)

Arguments

api

an instance of the TesseractBaseAPI-class obtained from a call to tesseract

files

a character vector giving the names of one or more tesseract configuration files. These can be paths to the files or alternatively just the names of the files if they are located in directories that tesseract searches by default. These are the subdirectories configs/ and tessconfigs/ within tesseracts data path which can be queried with GetDatapath.

debug

if TRUE, then only process the debug parameter settings and not the regular ones.

ok

a logical value which controls whether to check if the files actually exist

Value

This is used for its side-effect of updating the tesseract instance with the variable values in the file.

Author(s)

Duncan Temple Lang

References

http://zdenop.github.io/tesseract-doc/classtesseract_1_1_tess_base_a_p_i.html

See Also

tesseract

Examples

ts = tesseract()
ReadConfigFile(ts, "bigram", ok = TRUE) # read from tessdata/configs

f = system.file("sampleConfigFile", package = "Rtesseract")
GetVariables(ts)["certainty_scale"]
GetVariables(ts)["debug_fix_space_level"]
ReadConfigFile(ts, f, debug = TRUE)
GetVariables(ts)["debug_fix_space_level"]
GetVariables(ts)["certainty_scale"] # unchanged
ReadConfigFile(ts, f)
GetVariables(ts)["certainty_scale"] # changed

duncantl/Rtesseract documentation built on March 25, 2022, 5:50 a.m.