tesseract 4.1.1
Loading...
Searching...
No Matches
tesseract::CCUtil Class Reference

#include <ccutil.h>

Inheritance diagram for tesseract::CCUtil:
tesseract::CUtil tesseract::CCStruct tesseract::Classify tesseract::Wordrec tesseract::Tesseract

Public Member Functions

 CCUtil ()
 
virtual ~CCUtil ()
 
void main_setup (const char *argv0, const char *basename)
 CCUtil::main_setup - set location of tessdata and name of image. More...
 
ParamsVectorsparams ()
 

Public Attributes

STRING datadir
 
STRING imagebasename
 
STRING lang
 
STRING language_data_path_prefix
 
UNICHARSET unicharset
 
UnicharAmbigs unichar_ambigs
 
STRING imagefile
 
STRING directory
 
int ambigs_debug_level = 0
 
bool use_ambigs_for_adaption = false
 

Detailed Description

Definition at line 56 of file ccutil.h.

Constructor & Destructor Documentation

◆ CCUtil()

tesseract::CCUtil::CCUtil ( )

Definition at line 16 of file ccutil.cpp.

16 :
17 params_(),
18 INT_INIT_MEMBER(ambigs_debug_level, 0, "Debug level for unichar ambiguities",
19 &params_),
20 BOOL_MEMBER(use_ambigs_for_adaption, false, "Use ambigs for deciding"
21 " whether to adapt to a character", &params_) {
22}
#define INT_INIT_MEMBER(name, val, comment, vec)
Definition: params.h:327
#define BOOL_MEMBER(name, val, comment, vec)
Definition: params.h:318
int ambigs_debug_level
Definition: ccutil.h:87
bool use_ambigs_for_adaption
Definition: ccutil.h:89

◆ ~CCUtil()

tesseract::CCUtil::~CCUtil ( )
virtualdefault

Member Function Documentation

◆ main_setup()

void tesseract::CCUtil::main_setup ( const char *  argv0,
const char *  basename 
)

CCUtil::main_setup - set location of tessdata and name of image.

Parameters
argv0- paths to the directory with language files and config files. An actual value of argv0 is used if not nullptr, otherwise TESSDATA_PREFIX is used if not nullptr, next try to use compiled in -DTESSDATA_PREFIX. If previous is not successful - use current directory.
basename- name of image

< name of image

Definition at line 44 of file mainblk.cpp.

44 {
45 imagebasename = basename;
47 char *tessdata_prefix = getenv("TESSDATA_PREFIX");
48
49 if (argv0 != nullptr && *argv0 != '\0') {
50 /* Use tessdata prefix from the command line. */
51 datadir = argv0;
52 } else if (tessdata_prefix) {
53 /* Use tessdata prefix from the environment. */
54 datadir = tessdata_prefix;
55#if defined(_WIN32)
56 } else if (datadir == nullptr || _access(datadir.string(), 0) != 0) {
57 /* Look for tessdata in directory of executable. */
58 char path[_MAX_PATH];
59 DWORD length = GetModuleFileName(nullptr, path, sizeof(path));
60 if (length > 0 && length < sizeof(path)) {
61 char* separator = std::strrchr(path, '\\');
62 if (separator != nullptr) {
63 *separator = '\0';
64 datadir = path;
65 datadir += "/tessdata";
66 }
67 }
68#endif /* _WIN32 */
69#if defined(TESSDATA_PREFIX)
70 } else {
71/* Use tessdata prefix which was compiled in. */
72#define _STR(a) #a
73#define _XSTR(a) _STR(a)
74 datadir = _XSTR(TESSDATA_PREFIX) "/tessdata";
75#undef _XSTR
76#undef _STR
77#endif
78 }
79
80 // datadir may still be empty:
81 if (datadir.length() == 0) {
82 datadir = "./";
83 }
84
85 // check for missing directory separator
86 const char *lastchar = datadir.string();
87 lastchar += datadir.length() - 1;
88 if ((strcmp(lastchar, "/") != 0) && (strcmp(lastchar, "\\") != 0))
89 datadir += "/";
90}
STRING datadir
Definition: ccutil.h:69
STRING imagebasename
Definition: ccutil.h:70
int32_t length() const
Definition: strngs.cpp:189
const char * string() const
Definition: strngs.cpp:194

◆ params()

ParamsVectors * tesseract::CCUtil::params ( )
inline

Definition at line 67 of file ccutil.h.

67{ return &params_; }

Member Data Documentation

◆ ambigs_debug_level

int tesseract::CCUtil::ambigs_debug_level = 0

"Debug level for unichar ambiguities"

Definition at line 87 of file ccutil.h.

◆ datadir

STRING tesseract::CCUtil::datadir

Definition at line 69 of file ccutil.h.

◆ directory

STRING tesseract::CCUtil::directory

Definition at line 78 of file ccutil.h.

◆ imagebasename

STRING tesseract::CCUtil::imagebasename

Definition at line 70 of file ccutil.h.

◆ imagefile

STRING tesseract::CCUtil::imagefile

Definition at line 77 of file ccutil.h.

◆ lang

STRING tesseract::CCUtil::lang

Definition at line 71 of file ccutil.h.

◆ language_data_path_prefix

STRING tesseract::CCUtil::language_data_path_prefix

Definition at line 72 of file ccutil.h.

◆ unichar_ambigs

UnicharAmbigs tesseract::CCUtil::unichar_ambigs

Definition at line 75 of file ccutil.h.

◆ unicharset

UNICHARSET tesseract::CCUtil::unicharset

Definition at line 73 of file ccutil.h.

◆ use_ambigs_for_adaption

bool tesseract::CCUtil::use_ambigs_for_adaption = false

"Use ambigs for deciding whether to adapt to a character"

Definition at line 89 of file ccutil.h.


The documentation for this class was generated from the following files: