All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
 
TessdataManager tessdata_manager
 
UNICHARSET unicharset
 
UnicharAmbigs unichar_ambigs
 
STRING imagefile
 
STRING directory
 
char * m_data_sub_dir = "tessdata/"
 
int ambigs_debug_level = 0
 
bool use_definite_ambigs_for_classifier = 0
 
bool use_ambigs_for_adaption = 0
 

Detailed Description

Definition at line 54 of file ccutil.h.

Constructor & Destructor Documentation

tesseract::CCUtil::CCUtil ( )

Definition at line 7 of file ccutil.cpp.

7  :
8  params_(),
10  "tessdata/", "Directory for data files", &params_),
11 #ifdef _WIN32
12  STRING_INIT_MEMBER(tessedit_module_name, WINDLLNAME,
13  "Module colocated with tessdata dir", &params_),
14 #endif
15  INT_INIT_MEMBER(ambigs_debug_level, 0, "Debug level for unichar ambiguities",
16  &params_),
18  " ambiguities when running character classifier", &params_),
19  BOOL_MEMBER(use_ambigs_for_adaption, 0, "Use ambigs for deciding"
20  " whether to adapt to a character", &params_) {
21 }
#define BOOL_MEMBER(name, val, comment, vec)
Definition: params.h:304
char * m_data_sub_dir
Definition: ccutil.h:84
#define STRING_INIT_MEMBER(name, val, comment, vec)
Definition: params.h:319
bool use_ambigs_for_adaption
Definition: ccutil.h:93
bool use_definite_ambigs_for_classifier
Definition: ccutil.h:91
int ambigs_debug_level
Definition: ccutil.h:89
#define INT_INIT_MEMBER(name, val, comment, vec)
Definition: params.h:313
tesseract::CCUtil::~CCUtil ( )
virtual

Definition at line 23 of file ccutil.cpp.

23  {
24 }

Member Function Documentation

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 sucessul - use current directory.
basename- name of image

< name of image

< data directory

Definition at line 53 of file mainblk.cpp.

53  {
54  imagebasename = basename;
56  if (argv0 != NULL) {
57  datadir = argv0;
58  } else {
59  if (getenv("TESSDATA_PREFIX")) {
60  datadir = getenv("TESSDATA_PREFIX");
61  } else {
62 #ifdef TESSDATA_PREFIX
63 #define _STR(a) #a
64 #define _XSTR(a) _STR(a)
65  datadir = _XSTR(TESSDATA_PREFIX);
66 #undef _XSTR
67 #undef _STR
68 #endif
69  }
70  }
71 
72  // datadir may still be empty:
73  if (datadir.length() == 0) {
74  datadir = "./";
75  } else {
76  // Remove tessdata from the end if present, as we will add it back!
77  int length = datadir.length();
78  if (length >= 8 && strcmp(&datadir[length - 8], "tessdata") == 0)
79  datadir.truncate_at(length - 8);
80  else if (length >= 9 && strcmp(&datadir[length - 9], "tessdata/") == 0)
81  datadir.truncate_at(length - 9);
82  }
83 
84  // check for missing directory separator
85  const char *lastchar = datadir.string();
86  lastchar += datadir.length() - 1;
87  if ((strcmp(lastchar, "/") != 0) && (strcmp(lastchar, "\\") != 0))
88  datadir += "/";
89 
91 }
STRING imagebasename
Definition: ccutil.h:68
inT32 length() const
Definition: strngs.cpp:188
char * m_data_sub_dir
Definition: ccutil.h:84
STRING datadir
Definition: ccutil.h:67
void truncate_at(inT32 index)
Definition: strngs.cpp:264
#define NULL
Definition: host.h:144
const char * string() const
Definition: strngs.cpp:193
ParamsVectors* tesseract::CCUtil::params ( )
inline

Definition at line 65 of file ccutil.h.

65 { return &params_; }

Member Data Documentation

int tesseract::CCUtil::ambigs_debug_level = 0

"Debug level for unichar ambiguities"

Definition at line 89 of file ccutil.h.

STRING tesseract::CCUtil::datadir

Definition at line 67 of file ccutil.h.

STRING tesseract::CCUtil::directory

Definition at line 75 of file ccutil.h.

STRING tesseract::CCUtil::imagebasename

Definition at line 68 of file ccutil.h.

STRING tesseract::CCUtil::imagefile

Definition at line 74 of file ccutil.h.

STRING tesseract::CCUtil::lang

Definition at line 69 of file ccutil.h.

STRING tesseract::CCUtil::language_data_path_prefix

Definition at line 70 of file ccutil.h.

char* tesseract::CCUtil::m_data_sub_dir = "tessdata/"

"Directory for data files"

Definition at line 84 of file ccutil.h.

TessdataManager tesseract::CCUtil::tessdata_manager

Definition at line 71 of file ccutil.h.

UnicharAmbigs tesseract::CCUtil::unichar_ambigs

Definition at line 73 of file ccutil.h.

UNICHARSET tesseract::CCUtil::unicharset

Definition at line 72 of file ccutil.h.

bool tesseract::CCUtil::use_ambigs_for_adaption = 0

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

Definition at line 93 of file ccutil.h.

bool tesseract::CCUtil::use_definite_ambigs_for_classifier = 0

"Use definite ambiguities when running character classifier"

Definition at line 91 of file ccutil.h.


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