diff --git a/src/api/hocrrenderer.cpp b/src/api/hocrrenderer.cpp index f3ea4f5452..dde4b40950 100644 --- a/src/api/hocrrenderer.cpp +++ b/src/api/hocrrenderer.cpp @@ -239,7 +239,6 @@ char* TessBaseAPI::GetHOCRText(ETEXT_DESC* monitor, int page_number) { std::vector>>>* symbolMap = nullptr; if (lstm_choice_mode) { - choiceMap = res_it->GetBestLSTMSymbolChoices(); symbolMap = res_it->GetSegmentedLSTMTimesteps(); rawTimestepMap = res_it->GetRawLSTMTimesteps(); @@ -349,25 +348,25 @@ char* TessBaseAPI::GetHOCRText(ETEXT_DESC* monitor, int page_number) { } else if (lstm_choice_mode == 4) { for (auto timestep : *CTCMap) { if (timestep.size() > 0) { - hocr_str << "\n "; + hocr_str << "\n "; + const char* tag = "ins"; for (auto& j : timestep) { - float conf = 100 - tesseract_->lstm_rating_coefficient * j.second; - if (conf < 0.0f) - conf = 0.0f; - if (conf > 100.0f) - conf = 100.0f; - hocr_str << "" - << HOcrEscape(j.first).c_str() << ""; + << " title='nlp " << -std::log(conf / 100) + << "; x_confs " << conf << "'>" + << HOcrEscape(j.first).c_str() << ""; + tag = "del"; gcnt++; } - hocr_str << ""; + hocr_str << "\n "; tcnt++; } }