Replace remaining STRING by std::string in src/viewer and src/wordrec

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2021-03-14 19:58:27 +01:00
parent e0ce040832
commit 21d9aad594
7 changed files with 11 additions and 17 deletions

View File

@ -27,7 +27,7 @@
#ifndef TESSERACT_VIEWER_SVMNODE_H_ #ifndef TESSERACT_VIEWER_SVMNODE_H_
#define TESSERACT_VIEWER_SVMNODE_H_ #define TESSERACT_VIEWER_SVMNODE_H_
#include "strngs.h" #include <string>
namespace tesseract { namespace tesseract {
@ -86,11 +86,11 @@ private:
// The command event associated with a specific menu node. Should be unique. // The command event associated with a specific menu node. Should be unique.
int cmd_event_; int cmd_event_;
// The caption associated with a specific menu node. // The caption associated with a specific menu node.
STRING text_; std::string text_;
// The value of the menu node. (optional) // The value of the menu node. (optional)
STRING value_; std::string value_;
// A description_ of the value. (optional) // A description_ of the value. (optional)
STRING description_; std::string description_;
}; };
} // namespace tesseract } // namespace tesseract

View File

@ -1195,7 +1195,7 @@ void LanguageModel::UpdateBestChoice(ViterbiStateEntry *vse, LMPainPoints *pain_
ConstructWord(vse, word_res, &best_choice_bundle->fixpt, blamer_bundle, &truth_path); ConstructWord(vse, word_res, &best_choice_bundle->fixpt, blamer_bundle, &truth_path);
ASSERT_HOST(word != nullptr); ASSERT_HOST(word != nullptr);
if (dict_->stopper_debug_level >= 1) { if (dict_->stopper_debug_level >= 1) {
STRING word_str; std::string word_str;
word->string_and_lengths(&word_str, nullptr); word->string_and_lengths(&word_str, nullptr);
vse->Print(word_str.c_str()); vse->Print(word_str.c_str());
} }

View File

@ -31,8 +31,6 @@
#include "ratngs.h" // for BLOB_CHOICE (ptr only), BLOB_CHOICE_LIST... #include "ratngs.h" // for BLOB_CHOICE (ptr only), BLOB_CHOICE_LIST...
#include "stopper.h" // for DANGERR #include "stopper.h" // for DANGERR
#include "strngs.h" // for STRING
#include <cmath> // for exp #include <cmath> // for exp
namespace tesseract { namespace tesseract {
@ -358,7 +356,7 @@ protected:
// String representation of the classification of the previous word // String representation of the classification of the previous word
// (since this is only used by the character ngram model component, // (since this is only used by the character ngram model component,
// only the last language_model_ngram_order of the word are stored). // only the last language_model_ngram_order of the word are stored).
STRING prev_word_str_; std::string prev_word_str_;
int prev_word_unichar_step_len_ = 0; int prev_word_unichar_step_len_ = 0;
// Active dawg vector. // Active dawg vector.
DawgPositionVector very_beginning_active_dawgs_; // includes continuation DawgPositionVector very_beginning_active_dawgs_; // includes continuation

View File

@ -27,7 +27,6 @@
#include "lm_consistency.h" // for LMConsistencyInfo #include "lm_consistency.h" // for LMConsistencyInfo
#include "ratngs.h" // for BLOB_CHOICE, PermuterType #include "ratngs.h" // for BLOB_CHOICE, PermuterType
#include "stopper.h" // for DANGERR #include "stopper.h" // for DANGERR
#include "strngs.h" // for STRING
#include "unicharset.h" // for UNICHARSET #include "unicharset.h" // for UNICHARSET
namespace tesseract { namespace tesseract {
@ -73,7 +72,7 @@ struct LanguageModelNgramInfo {
, pruned(p) , pruned(p)
, ngram_cost(nc) , ngram_cost(nc)
, ngram_and_classifier_cost(ncc) {} , ngram_and_classifier_cost(ncc) {}
STRING context; ///< context string std::string context; ///< context string
/// Length of the context measured by advancing using UNICHAR::utf8_step() /// Length of the context measured by advancing using UNICHAR::utf8_step()
/// (should be at most the order of the character ngram model used). /// (should be at most the order of the character ngram model used).
int context_unichar_step_len; int context_unichar_step_len;
@ -110,7 +109,7 @@ struct ViterbiStateEntry : public ELIST_LINK {
, associate_stats(as) , associate_stats(as)
, top_choice_flags(tcf) , top_choice_flags(tcf)
, updated(true) { , updated(true) {
debug_str = (debug_uch == nullptr) ? nullptr : new STRING(); debug_str = (debug_uch == nullptr) ? nullptr : new std::string();
if (pe != nullptr) { if (pe != nullptr) {
ratings_sum += pe->ratings_sum; ratings_sum += pe->ratings_sum;
if (pe->min_certainty < min_certainty) { if (pe->min_certainty < min_certainty) {
@ -172,7 +171,7 @@ struct ViterbiStateEntry : public ELIST_LINK {
/// UTF8 string representing the path corresponding to this vse. /// UTF8 string representing the path corresponding to this vse.
/// Populated only in when language_model_debug_level > 0. /// Populated only in when language_model_debug_level > 0.
STRING *debug_str; std::string *debug_str;
/// The cost is an adjusted ratings sum, that is adjusted by all the language /// The cost is an adjusted ratings sum, that is adjusted by all the language
/// model components that use Viterbi search. /// model components that use Viterbi search.

View File

@ -21,7 +21,6 @@
#include "genericvector.h" // for GenericVector #include "genericvector.h" // for GenericVector
#include "params_training_featdef.h" // for PTRAIN_NUM_FEATURE_TYPES #include "params_training_featdef.h" // for PTRAIN_NUM_FEATURE_TYPES
#include "strngs.h" // for STRING
namespace tesseract { namespace tesseract {
@ -79,7 +78,7 @@ public:
private: private:
bool ParseLine(char *line, char **key, float *val); bool ParseLine(char *line, char **key, float *val);
STRING lang_; std::string lang_;
// Set to the current pass type and used to determine which set of weights // Set to the current pass type and used to determine which set of weights
// should be used for ComputeCost() and other functions. // should be used for ComputeCost() and other functions.
PassEnum pass_; PassEnum pass_;

View File

@ -26,7 +26,6 @@
#include "pageres.h" // for WERD_RES #include "pageres.h" // for WERD_RES
#include "params.h" // for BoolParam, IntParam, DoubleParam #include "params.h" // for BoolParam, IntParam, DoubleParam
#include "ratngs.h" // for BLOB_CHOICE_LIST, BLOB_CHOICE_IT #include "ratngs.h" // for BLOB_CHOICE_LIST, BLOB_CHOICE_IT
#include "strngs.h" // for STRING
#include "tprintf.h" // for tprintf #include "tprintf.h" // for tprintf
#include "wordrec.h" // for Wordrec, SegSearchPending (ptr only) #include "wordrec.h" // for Wordrec, SegSearchPending (ptr only)
@ -65,7 +64,7 @@ void Wordrec::SegSearch(WERD_RES *word_res, BestChoiceBundle *best_choice_bundle
MATRIX_COORD pain_point; MATRIX_COORD pain_point;
float pain_point_priority; float pain_point_priority;
int num_futile_classifications = 0; int num_futile_classifications = 0;
STRING blamer_debug; std::string blamer_debug;
while (wordrec_enable_assoc && while (wordrec_enable_assoc &&
(!SegSearchDone(num_futile_classifications) || (!SegSearchDone(num_futile_classifications) ||
(blamer_bundle != nullptr && blamer_bundle->GuidedSegsearchStillGoing()))) { (blamer_bundle != nullptr && blamer_bundle->GuidedSegsearchStillGoing()))) {

View File

@ -89,7 +89,6 @@ namespace tesseract {
class EDGEPT_CLIST; class EDGEPT_CLIST;
class MATRIX; class MATRIX;
class STRING;
class TBOX; class TBOX;
class UNICHARSET; class UNICHARSET;
class WERD_RES; class WERD_RES;