diff --git a/Makefile.am b/Makefile.am index 80f15926..6473b56f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1192,7 +1192,6 @@ libabseil_la_SOURCES += abseil/absl/strings/internal/str_format/output.cc libabseil_la_SOURCES += abseil/absl/strings/internal/str_format/parser.cc libabseil_la_SOURCES += abseil/absl/strings/match.cc libabseil_la_SOURCES += abseil/absl/strings/numbers.cc -libabseil_la_SOURCES += abseil/absl/strings/str_cat.cc libabseil_la_SOURCES += abseil/absl/strings/str_split.cc libabseil_la_SOURCES += abseil/absl/strings/string_view.cc libabseil_la_CPPFLAGS = -I$(top_srcdir)/abseil @@ -1381,7 +1380,7 @@ heap_test_LDADD = $(TESS_LIBS) imagedata_test_SOURCES = unittest/imagedata_test.cc imagedata_test_CPPFLAGS = $(unittest_CPPFLAGS) -imagedata_test_LDADD = $(ABSEIL_LIBS) $(TRAINING_LIBS) +imagedata_test_LDADD = $(TRAINING_LIBS) if !DISABLED_LEGACY_ENGINE indexmapbidi_test_SOURCES = unittest/indexmapbidi_test.cc @@ -1407,7 +1406,7 @@ intsimdmatrix_test_LDADD = $(TESS_LIBS) lang_model_test_SOURCES = unittest/lang_model_test.cc lang_model_test_CPPFLAGS = $(unittest_CPPFLAGS) -lang_model_test_LDADD = $(ABSEIL_LIBS) $(TRAINING_LIBS) $(ICU_I18N_LIBS) $(ICU_UC_LIBS) +lang_model_test_LDADD = $(TRAINING_LIBS) $(ICU_I18N_LIBS) $(ICU_UC_LIBS) layout_test_SOURCES = unittest/layout_test.cc layout_test_CPPFLAGS = $(unittest_CPPFLAGS) diff --git a/unittest/baseapi_test.cc b/unittest/baseapi_test.cc index fbe63723..d8165f04 100644 --- a/unittest/baseapi_test.cc +++ b/unittest/baseapi_test.cc @@ -20,7 +20,6 @@ #include #include "absl/strings/ascii.h" -#include "absl/strings/str_cat.h" #include "gmock/gmock-matchers.h" #include @@ -323,7 +322,9 @@ TEST(TesseractInstanceTest, TestMultipleTessInstances) { // Preload images and verify that OCR is correct on them individually. std::vector pix(num_langs); for (int i = 0; i < num_langs; ++i) { - SCOPED_TRACE(absl::StrCat("Single instance test with lang = ", langs[i])); + std::string tracestring = "Single instance test with lang = "; + tracestring += langs[i]; + SCOPED_TRACE(tracestring); std::string path = file::JoinPath(TESTING_DIR, image_files[i]); pix[i] = pixRead(path.c_str()); QCHECK(pix[i] != nullptr) << "Could not read " << path; diff --git a/unittest/imagedata_test.cc b/unittest/imagedata_test.cc index 3c93ce18..2b185ef9 100644 --- a/unittest/imagedata_test.cc +++ b/unittest/imagedata_test.cc @@ -12,8 +12,6 @@ #include #include -#include "absl/strings/str_cat.h" - #include "imagedata.h" #include "include_gunit.h" #include "log.h" @@ -52,7 +50,8 @@ protected: } // Write it to a file. std::string filename = - file::JoinPath(FLAGS_test_tmpdir, absl::StrCat("documentdata", doc_id, ".lstmf")); + file::JoinPath(FLAGS_test_tmpdir, "documentdata"); + filename += std::to_string(doc_id) + ".lstmf"; EXPECT_TRUE(write_doc.SaveDocument(filename.c_str(), nullptr)); return filename; } diff --git a/unittest/lang_model_test.cc b/unittest/lang_model_test.cc index e0d96abc..048ee13e 100644 --- a/unittest/lang_model_test.cc +++ b/unittest/lang_model_test.cc @@ -11,8 +11,6 @@ #include // for std::string -#include "absl/strings/str_cat.h" - #include "gmock/gmock.h" // for testing::ElementsAreArray #include "include_gunit.h" @@ -59,7 +57,7 @@ TEST(LangModelTest, AddACharacter) { pass_through_recoder, words, puncs, numbers, lang_is_rtl, nullptr, nullptr)); // Init a trainer with it, and encode kTestString. - std::string traineddata1 = file::JoinPath(output_dir, lang1, absl::StrCat(lang1, ".traineddata")); + std::string traineddata1 = file::JoinPath(output_dir, lang1, lang1) + ".traineddata"; LSTMTrainer trainer1; trainer1.InitCharSet(traineddata1); std::vector labels1; @@ -79,7 +77,7 @@ TEST(LangModelTest, AddACharacter) { pass_through_recoder, words, puncs, numbers, lang_is_rtl, nullptr, nullptr)); // Init a trainer with it, and encode kTestString. - std::string traineddata2 = file::JoinPath(output_dir, lang2, absl::StrCat(lang2, ".traineddata")); + std::string traineddata2 = file::JoinPath(output_dir, lang2, lang2) + ".traineddata"; LSTMTrainer trainer2; trainer2.InitCharSet(traineddata2); std::vector labels2; @@ -144,7 +142,7 @@ TEST(LangModelTest, AddACharacterHindi) { pass_through_recoder, words, puncs, numbers, lang_is_rtl, nullptr, nullptr)); // Init a trainer with it, and encode kTestString. - std::string traineddata1 = file::JoinPath(output_dir, lang1, absl::StrCat(lang1, ".traineddata")); + std::string traineddata1 = file::JoinPath(output_dir, lang1, lang1) + ".traineddata"; LSTMTrainer trainer1; trainer1.InitCharSet(traineddata1); std::vector labels1; @@ -164,7 +162,7 @@ TEST(LangModelTest, AddACharacterHindi) { pass_through_recoder, words, puncs, numbers, lang_is_rtl, nullptr, nullptr)); // Init a trainer with it, and encode kTestString. - std::string traineddata2 = file::JoinPath(output_dir, lang2, absl::StrCat(lang2, ".traineddata")); + std::string traineddata2 = file::JoinPath(output_dir, lang2, lang2) + ".traineddata"; LSTMTrainer trainer2; trainer2.InitCharSet(traineddata2); std::vector labels2; diff --git a/unittest/lstm_test.h b/unittest/lstm_test.h index 585f56e3..0b0ff6f5 100644 --- a/unittest/lstm_test.h +++ b/unittest/lstm_test.h @@ -18,7 +18,6 @@ #include "include_gunit.h" -#include "absl/strings/str_cat.h" #include "helpers.h" #include "tprintf.h" @@ -81,7 +80,7 @@ protected: std::string checkpoint_path = model_path + "_checkpoint"; trainer_ = std::make_unique(model_path.c_str(), checkpoint_path.c_str(), 0, 0); trainer_->InitCharSet( - file::JoinPath(FLAGS_test_tmpdir, kLang, absl::StrCat(kLang, ".traineddata"))); + file::JoinPath(FLAGS_test_tmpdir, kLang, kLang) + ".traineddata"); int net_mode = adam ? NF_ADAM : 0; // Adam needs a higher learning rate, due to not multiplying the effective // rate by 1/(1-momentum). diff --git a/unittest/normstrngs_test.h b/unittest/normstrngs_test.h index 80577f73..fbc8ea64 100644 --- a/unittest/normstrngs_test.h +++ b/unittest/normstrngs_test.h @@ -16,7 +16,6 @@ #include // for std::stringstream #include #include -#include "absl/strings/str_cat.h" #include "absl/strings/str_join.h" namespace tesseract { @@ -33,7 +32,9 @@ inline std::string CodepointList(const std::vector &str32) { inline std::string PrintString32WithUnicodes(const std::string &str) { std::vector str32 = UNICHAR::UTF8ToUTF32(str.c_str()); - return absl::StrCat("\"", str, "\" ", CodepointList(str32)); + std::string s = "\""; + s += "\" " + CodepointList(str32); + return s; } inline std::string PrintStringVectorWithUnicodes(const std::vector &glyphs) { diff --git a/unittest/pango_font_info_test.cc b/unittest/pango_font_info_test.cc index b3862e50..27938843 100644 --- a/unittest/pango_font_info_test.cc +++ b/unittest/pango_font_info_test.cc @@ -13,7 +13,6 @@ #include #include #include -#include "absl/strings/str_cat.h" // for absl::StrCat #include "commandlineflags.h" #include "fileio.h" #include "gmock/gmock-matchers.h" // for EXPECT_THAT @@ -316,7 +315,8 @@ TEST_F(FontUtilsTest, GetAllRenderableCharacters) { // Check that none of the included fonts cover the Mongolian or Ogham space // characters. for (size_t f = 0; f < countof(kExpectedFontNames); ++f) { - SCOPED_TRACE(absl::StrCat("Testing ", kExpectedFontNames[f])); + std::string tracestring = "Testing " + kExpectedFontNames[f]; + SCOPED_TRACE(tracestring); FontUtils::GetAllRenderableCharacters(kExpectedFontNames[f], &unicode_mask); # if 0 // TODO: check fails because DejaVu Sans Ultra-Light supports ogham EXPECT_FALSE(unicode_mask[kOghamChar]); diff --git a/unittest/paragraphs_test.cc b/unittest/paragraphs_test.cc index c30f859a..2a4cc966 100644 --- a/unittest/paragraphs_test.cc +++ b/unittest/paragraphs_test.cc @@ -11,7 +11,6 @@ #include // for std::string -#include "absl/strings/str_cat.h" // for absl::StrCat #include "absl/strings/str_join.h" // for absl::StrJoin #include "absl/strings/str_split.h" // for absl::StrSplit @@ -156,10 +155,11 @@ void EvaluateParagraphDetection(const TextAndModel *correct, int n, dbg_lines.emplace_back("# =========================="); for (int i = 0; i < n; i++) { if (correct[i].model_type != PCONT) { - dbg_lines.push_back(absl::StrCat(correct[i].ascii, " # ", - correct[i].model.ToString().c_str(), - correct[i].is_very_first_or_continuation ? " crown" : "", - correct[i].is_list_item ? " li" : "")); + std::string s = std::string(correct[i].ascii) + " # " + + correct[i].model.ToString() + + (correct[i].is_very_first_or_continuation ? " crown" : "") + + (correct[i].is_list_item ? " li" : ""); + dbg_lines.push_back(s); } else { dbg_lines.emplace_back(correct[i].ascii); } @@ -173,14 +173,15 @@ void EvaluateParagraphDetection(const TextAndModel *correct, int n, if (i == 0 || (detector_output[i - 1] != detector_output[i])) { if (detector_output[i] && detector_output[i]->model) { annotation += - absl::StrCat(" # ", detector_output[i]->model->ToString().c_str(), - detector_output[i]->is_very_first_or_continuation ? " crown" : "", - detector_output[i]->is_list_item ? " li" : ""); + " # " + detector_output[i]->model->ToString() + + (detector_output[i]->is_very_first_or_continuation ? " crown" : "") + + (detector_output[i]->is_list_item ? " li" : ""); } else { annotation = " # Unmodeled paragraph."; } } - dbg_lines.push_back(absl::StrCat(correct[i].ascii, annotation)); + std::string s = correct[i].ascii + annotation; + dbg_lines.push_back(s); } LOG(INFO) << "Discrepancy!\n" << absl::StrJoin(dbg_lines, "\n"); } diff --git a/unittest/unicharcompress_test.cc b/unittest/unicharcompress_test.cc index 9787da10..a74902d3 100644 --- a/unittest/unicharcompress_test.cc +++ b/unittest/unicharcompress_test.cc @@ -13,7 +13,6 @@ #include #include "absl/strings/ascii.h" -#include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" #include "include_gunit.h" @@ -46,7 +45,7 @@ protected: compressed_.EncodeUnichar(null_char_, &code); encoded_null_char_ = code(0); std::string output_name = - file::JoinPath(FLAGS_test_tmpdir, absl::StrCat(unicharset_name, ".encoding.txt")); + file::JoinPath(FLAGS_test_tmpdir, unicharset_name) + ".encoding.txt"; std::string encoding = compressed_.GetEncodingAsString(unicharset_); std::string encoding_str(&encoding[0], encoding.size()); CHECK_OK(file::SetContents(output_name, encoding_str, file::Defaults()));