tesseract  5.0.0-alpha-619-ge9db
tesseract::CCUtil Class Reference

#include <ccutil.h>

Inheritance diagram for tesseract::CCUtil:
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 40 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 }

◆ ~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 58 of file mainblk.cpp.

60  {
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.c_str();
87  lastchar += datadir.length() - 1;
88  if ((strcmp(lastchar, "/") != 0) && (strcmp(lastchar, "\\") != 0))
89  datadir += "/";
90 }
91 } // namespace tesseract

◆ params()

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

Definition at line 51 of file ccutil.h.

51 { return &params_; }

Member Data Documentation

◆ ambigs_debug_level

int tesseract::CCUtil::ambigs_debug_level = 0

"Debug level for unichar ambiguities"

Definition at line 71 of file ccutil.h.

◆ datadir

STRING tesseract::CCUtil::datadir

Definition at line 53 of file ccutil.h.

◆ directory

STRING tesseract::CCUtil::directory

Definition at line 62 of file ccutil.h.

◆ imagebasename

STRING tesseract::CCUtil::imagebasename

Definition at line 54 of file ccutil.h.

◆ imagefile

STRING tesseract::CCUtil::imagefile

Definition at line 61 of file ccutil.h.

◆ lang

STRING tesseract::CCUtil::lang

Definition at line 55 of file ccutil.h.

◆ language_data_path_prefix

STRING tesseract::CCUtil::language_data_path_prefix

Definition at line 56 of file ccutil.h.

◆ unichar_ambigs

UnicharAmbigs tesseract::CCUtil::unichar_ambigs

Definition at line 59 of file ccutil.h.

◆ unicharset

UNICHARSET tesseract::CCUtil::unicharset

Definition at line 57 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 73 of file ccutil.h.


The documentation for this class was generated from the following files:
tesseract::CCUtil::datadir
STRING datadir
Definition: ccutil.h:53
tesseract::CCUtil::use_ambigs_for_adaption
bool use_ambigs_for_adaption
Definition: ccutil.h:73
INT_INIT_MEMBER
#define INT_INIT_MEMBER(name, val, comment, vec)
Definition: params.h:324
STRING::c_str
const char * c_str() const
Definition: strngs.cpp:192
tesseract::CCUtil::ambigs_debug_level
int ambigs_debug_level
Definition: ccutil.h:71
STRING::length
int32_t length() const
Definition: strngs.cpp:187
BOOL_MEMBER
#define BOOL_MEMBER(name, val, comment, vec)
Definition: params.h:315