22#ifndef TESSERACT_TRAINING_BOXCHAR_H_
23#define TESSERACT_TRAINING_BOXCHAR_H_
28#include <allheaders.h>
29#if (LIBLEPT_MAJOR_VERSION == 1 && LIBLEPT_MINOR_VERSION >= 83) || LIBLEPT_MAJOR_VERSION > 1
30#include <pix_internal.h>
38 BoxChar(
const char *utf8_str,
int len);
43 const std::string &
ch()
const {
46 const Box *
box()
const {
60 void AddBox(
int x,
int y,
int width,
int height);
76 if (box_ ==
nullptr) {
79 if (other.box_ ==
nullptr) {
82 return box_->x < other.box_->x;
91 static void TranslateBoxes(
int xshift,
int yshift, std::vector<BoxChar *> *boxes);
97 static void InsertNewlines(
bool rtl_rules,
bool vertical_rules, std::vector<BoxChar *> *boxes);
100 static void InsertSpaces(
bool rtl_rules,
bool vertical_rules, std::vector<BoxChar *> *boxes);
113 static void RotateBoxes(
float rotation,
int xcenter,
int ycenter,
int start_box,
int end_box,
114 std::vector<BoxChar *> *boxes);
119 const std::vector<BoxChar *> &boxes);
122 static std::string
GetTesseractBoxStr(
int height,
const std::vector<BoxChar *> &boxes);
139 return *box1 < *box2;
bool operator<(const BoxChar &other) const
static bool MostlyVertical(const std::vector< BoxChar * > &boxes)
static void WriteTesseractBoxFile(const std::string &name, int height, const std::vector< BoxChar * > &boxes)
static void PrepareToWrite(std::vector< BoxChar * > *boxes)
static void InsertSpaces(bool rtl_rules, bool vertical_rules, std::vector< BoxChar * > *boxes)
BoxChar(const char *utf8_str, int len)
void set_rtl_index(int index)
void ReverseUnicodesInBox()
void GetDirection(int *num_rtl, int *num_ltr) const
static void ReorderRTLText(std::vector< BoxChar * > *boxes)
static int TotalByteLength(const std::vector< BoxChar * > &boxes)
static std::string GetTesseractBoxStr(int height, const std::vector< BoxChar * > &boxes)
static void TranslateBoxes(int xshift, int yshift, std::vector< BoxChar * > *boxes)
void AddBox(int x, int y, int width, int height)
static void RotateBoxes(float rotation, int xcenter, int ycenter, int start_box, int end_box, std::vector< BoxChar * > *boxes)
const std::string & ch() const
static bool ContainsMostlyRTL(const std::vector< BoxChar * > &boxes)
const int & rtl_index() const
static void InsertNewlines(bool rtl_rules, bool vertical_rules, std::vector< BoxChar * > *boxes)
std::string * mutable_ch()
bool operator()(const BoxChar *box1, const BoxChar *box2) const