30 static void AddBoxToLSTM(
int right,
int bottom,
int top,
int image_height,
31 int page_num,
STRING* text) {
43 bool first_word =
true;
44 int left = 0, top = 0, right = 0, bottom = 0;
54 if (res_it->IsAtBeginningOf(
RIL_WORD)) {
55 lstm_box_str.add_str_int(
" ", left);
62 lstm_box_str.add_str_int(
"\t ", left);
71 res_it->BoundingBox(
RIL_TEXTLINE, &left, &top, &right, &bottom);
74 std::unique_ptr<const char[]>(res_it->GetUTF8Text(
RIL_SYMBOL)).get();
77 lstm_box_str.add_str_int(
" ", left);
78 AddBoxToLSTM(right, bottom, top,
image_height_, page_number, &lstm_box_str);
82 lstm_box_str.add_str_int(
"\t ", left);
83 AddBoxToLSTM(right, bottom, top,
image_height_, page_number, &lstm_box_str);
86 char* ret =
new char[lstm_box_str.length() + 1];
87 strcpy(ret, lstm_box_str.c_str());
99 const std::unique_ptr<const char[]> lstmbox(api->GetLSTMBoxText(
imagenum()));
100 if (lstmbox ==
nullptr)
return false;