tesseract  4.0.0-beta.1-59-g2cc4
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_definite_ambigs_for_classifier = 0
 
bool use_ambigs_for_adaption = 0
 

Detailed Description

Definition at line 51 of file ccutil.h.

Constructor & Destructor Documentation

◆ CCUtil()

tesseract::CCUtil::CCUtil ( )

Definition at line 16 of file ccutil.cpp.

16  :
17  params_(),
18 #ifdef _WIN32
19  STRING_INIT_MEMBER(tessedit_module_name, WINDLLNAME,
20  "Module colocated with tessdata dir", &params_),
21 #endif
22  INT_INIT_MEMBER(ambigs_debug_level, 0, "Debug level for unichar ambiguities",
23  &params_),
25  " ambiguities when running character classifier", &params_),
26  BOOL_MEMBER(use_ambigs_for_adaption, 0, "Use ambigs for deciding"
27  " whether to adapt to a character", &params_) {
28 }
#define BOOL_MEMBER(name, val, comment, vec)
Definition: params.h:303
int ambigs_debug_level
Definition: ccutil.h:84
bool use_ambigs_for_adaption
Definition: ccutil.h:88
bool use_definite_ambigs_for_classifier
Definition: ccutil.h:86
#define INT_INIT_MEMBER(name, val, comment, vec)
Definition: params.h:312
#define STRING_INIT_MEMBER(name, val, comment, vec)
Definition: params.h:318

◆ ~CCUtil()

tesseract::CCUtil::~CCUtil ( )
virtual

Definition at line 30 of file ccutil.cpp.

30  {
31 }

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 NULL, otherwise TESSDATA_PREFIX is used if not NULL, 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 53 of file mainblk.cpp.

53  {
54  imagebasename = basename;
56  char *tessdata_prefix = getenv("TESSDATA_PREFIX");
57 
58  if (argv0 != NULL && *argv0 != '\0') {
59  /* Use tessdata prefix from the command line. */
60  datadir = argv0;
61  } else if (tessdata_prefix) {
62  /* Use tessdata prefix from the environment. */
63  datadir = tessdata_prefix;
64 #if defined(_WIN32)
65  } else if (datadir == NULL || access(datadir.string(), 0) != 0) {
66  /* Look for tessdata in directory of executable. */
67  static char dir[128];
68  static char exe[128];
69  DWORD length = GetModuleFileName(NULL, exe, sizeof(exe));
70  if (length > 0 && length < sizeof(exe)) {
71  _splitpath(exe, NULL, dir, NULL, NULL);
72  datadir = dir;
73  }
74 #endif /* _WIN32 */
75 #if defined(TESSDATA_PREFIX)
76  } else {
77 /* Use tessdata prefix which was compiled in. */
78 #define _STR(a) #a
79 #define _XSTR(a) _STR(a)
80  datadir = _XSTR(TESSDATA_PREFIX) "/tessdata";
81 #undef _XSTR
82 #undef _STR
83 #endif
84  }
85 
86  // datadir may still be empty:
87  if (datadir.length() == 0) {
88  datadir = "./";
89  }
90 
91  // check for missing directory separator
92  const char *lastchar = datadir.string();
93  lastchar += datadir.length() - 1;
94  if ((strcmp(lastchar, "/") != 0) && (strcmp(lastchar, "\\") != 0))
95  datadir += "/";
96 }
STRING imagebasename
Definition: ccutil.h:65
STRING datadir
Definition: ccutil.h:64
const char * string() const
Definition: strngs.cpp:198
int32_t length() const
Definition: strngs.cpp:193

◆ params()

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

Definition at line 62 of file ccutil.h.

62 { return &params_; }

Member Data Documentation

◆ ambigs_debug_level

int tesseract::CCUtil::ambigs_debug_level = 0

"Debug level for unichar ambiguities"

Definition at line 84 of file ccutil.h.

◆ datadir

STRING tesseract::CCUtil::datadir

Definition at line 64 of file ccutil.h.

◆ directory

STRING tesseract::CCUtil::directory

Definition at line 71 of file ccutil.h.

◆ imagebasename

STRING tesseract::CCUtil::imagebasename

Definition at line 65 of file ccutil.h.

◆ imagefile

STRING tesseract::CCUtil::imagefile

Definition at line 70 of file ccutil.h.

◆ lang

STRING tesseract::CCUtil::lang

Definition at line 66 of file ccutil.h.

◆ language_data_path_prefix

STRING tesseract::CCUtil::language_data_path_prefix

Definition at line 67 of file ccutil.h.

◆ unichar_ambigs

UnicharAmbigs tesseract::CCUtil::unichar_ambigs

Definition at line 69 of file ccutil.h.

◆ unicharset

UNICHARSET tesseract::CCUtil::unicharset

Definition at line 68 of file ccutil.h.

◆ use_ambigs_for_adaption

bool tesseract::CCUtil::use_ambigs_for_adaption = 0

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

Definition at line 88 of file ccutil.h.

◆ use_definite_ambigs_for_classifier

bool tesseract::CCUtil::use_definite_ambigs_for_classifier = 0

"Use definite ambiguities when running character classifier"

Definition at line 86 of file ccutil.h.


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