23 #ifndef TESSERACT_TRAINING_BOXCHAR_H_ 24 #define TESSERACT_TRAINING_BOXCHAR_H_ 29 #include "allheaders.h" 38 BoxChar(
const char* utf8_str,
int len);
43 const std::string&
ch()
const {
return ch_; }
50 void AddBox(
int x,
int y,
int width,
int height);
60 if (
box_ ==
nullptr)
return true;
61 if (other.
box_ ==
nullptr)
return false;
72 std::vector<BoxChar*>* boxes);
79 std::vector<BoxChar*>* boxes);
82 static void InsertSpaces(
bool rtl_rules,
bool vertical_rules,
83 std::vector<BoxChar*>* boxes);
101 std::vector<BoxChar*>* boxes);
106 const std::vector<BoxChar*>& boxes);
110 const std::vector<BoxChar*>& boxes);
126 return *box1 < *box2;
132 #endif // TESSERACT_TRAINING_BOXCHAR_H_ void set_page(int page)
Definition: boxchar.h:52
Box * mutable_box()
Definition: boxchar.h:55
static void ReorderRTLText(std::vector< BoxChar *> *boxes)
Definition: boxchar.cpp:235
static void RotateBoxes(float rotation, int xcenter, int ycenter, int start_box, int end_box, std::vector< BoxChar *> *boxes)
Definition: boxchar.cpp:299
static void InsertNewlines(bool rtl_rules, bool vertical_rules, std::vector< BoxChar *> *boxes)
Definition: boxchar.cpp:112
static bool ContainsMostlyRTL(const std::vector< BoxChar *> &boxes)
Definition: boxchar.cpp:260
void ReverseUnicodesInBox()
Definition: boxchar.cpp:76
static void TranslateBoxes(int xshift, int yshift, std::vector< BoxChar *> *boxes)
Definition: boxchar.cpp:83
BoxChar(const char *utf8_str, int len)
Definition: boxchar.cpp:41
static int TotalByteLength(const std::vector< BoxChar *> &boxes)
Definition: boxchar.cpp:289
std::string * mutable_ch()
Definition: boxchar.h:54
bool operator<(const BoxChar &other) const
Definition: boxchar.h:59
const Box * box() const
Definition: boxchar.h:44
Definition: baseapi.cpp:94
void set_rtl_index(int index)
Definition: boxchar.h:46
bool operator()(const BoxChar *box1, const BoxChar *box2) const
Definition: boxchar.h:123
int rtl_index_
Definition: boxchar.h:118
static void PrepareToWrite(std::vector< BoxChar *> *boxes)
Definition: boxchar.cpp:97
void GetDirection(int *num_rtl, int *num_ltr) const
Definition: boxchar.cpp:52
const std::string & ch() const
Definition: boxchar.h:43
void AddBox(int x, int y, int width, int height)
Definition: boxchar.cpp:46
static bool MostlyVertical(const std::vector< BoxChar *> &boxes)
Definition: boxchar.cpp:270
Box * box_
Definition: boxchar.h:114
static void InsertSpaces(bool rtl_rules, bool vertical_rules, std::vector< BoxChar *> *boxes)
Definition: boxchar.cpp:177
int page_
Definition: boxchar.h:115
const int & rtl_index() const
Definition: boxchar.h:47
static std::string GetTesseractBoxStr(int height, const std::vector< BoxChar *> &boxes)
Definition: boxchar.cpp:327
~BoxChar()
Definition: boxchar.cpp:44
const int & page() const
Definition: boxchar.h:45
Definition: boxchar.h:122
static void WriteTesseractBoxFile(const std::string &name, int height, const std::vector< BoxChar *> &boxes)
Definition: boxchar.cpp:320
std::string ch_
Definition: boxchar.h:113