From 688f8283c5071a91f2ab339cd2c003e12d11be51 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 23 Oct 2024 14:59:15 +0200 Subject: [PATCH 1/3] Fix some code comments Signed-off-by: Stefan Weil --- src/api/pagerenderer.cpp | 4 ++-- src/ccstruct/blobbox.cpp | 2 +- src/textord/blkocc.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/pagerenderer.cpp b/src/api/pagerenderer.cpp index 7d67261050..cd2d0a5ed9 100644 --- a/src/api/pagerenderer.cpp +++ b/src/api/pagerenderer.cpp @@ -493,7 +493,7 @@ Pta *FitBaselineIntoLinePolygon(Pta *bottom_pts, Pta *baseline_pts, } num_pts = ptaGetCount(bottom_pts); - // Create a interpolated polygon with stepsize 1 + // Create an interpolated polygon with stepsize 1. for (int index = 0; index < num_pts - 1; ++index) { ptaGetIPt(bottom_pts, index, &x0, &y0); ptaGetIPt(bottom_pts, index + 1, &x1, &y1); @@ -636,7 +636,7 @@ bool TessPAGERenderer::AddImageHandler(TessBaseAPI *api) { "pagecontent.xsd\">\n" "\t if (std::regex_search(api->GetInputName(), std::regex("^(https?|ftp|ssh):"))) { diff --git a/src/ccstruct/blobbox.cpp b/src/ccstruct/blobbox.cpp index 6201a31ce4..7356fdb4fd 100644 --- a/src/ccstruct/blobbox.cpp +++ b/src/ccstruct/blobbox.cpp @@ -883,7 +883,7 @@ void vertical_cblob_projection( // project outlines /********************************************************************** * vertical_coutline_projection * - * Compute the vertical projection of a outline from its outlines + * Compute the vertical projection of an outline from its outlines * and add to the given STATS. **********************************************************************/ diff --git a/src/textord/blkocc.cpp b/src/textord/blkocc.cpp index 69e18f6a74..60283e744f 100644 --- a/src/textord/blkocc.cpp +++ b/src/textord/blkocc.cpp @@ -125,7 +125,7 @@ static void horizontal_cblob_projection( // project outlines /** * horizontal_coutline_projection * - * Compute the horizontal projection of a outline from its outlines + * Compute the horizontal projection of an outline from its outlines * and add to the given STATS. */ From 31e864b4a417909b8d28137ae00cfe68c73d56ae Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 23 Oct 2024 15:03:44 +0200 Subject: [PATCH 2/3] Fix Settup -> Setup in method names Signed-off-by: Stefan Weil --- src/classify/adaptmatch.cpp | 12 ++++++------ src/classify/classify.h | 4 ++-- src/dict/dict.h | 4 ++-- src/dict/stopper.cpp | 4 ++-- src/wordrec/tface.cpp | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/classify/adaptmatch.cpp b/src/classify/adaptmatch.cpp index 5c02c6f363..273259f918 100644 --- a/src/classify/adaptmatch.cpp +++ b/src/classify/adaptmatch.cpp @@ -644,12 +644,12 @@ void Classify::StartBackupAdaptiveClassifier() { * - #EnableLearning * set to true by this routine */ -void Classify::SettupPass1() { +void Classify::SetupPass1() { EnableLearning = classify_enable_learning; - getDict().SettupStopperPass1(); + getDict().SetupStopperPass1(); -} /* SettupPass1 */ +} /* SetupPass1 */ /*---------------------------------------------------------------------------*/ /** @@ -660,11 +660,11 @@ void Classify::SettupPass1() { * Globals: * - #EnableLearning set to false by this routine */ -void Classify::SettupPass2() { +void Classify::SetupPass2() { EnableLearning = false; - getDict().SettupStopperPass2(); + getDict().SetupStopperPass2(); -} /* SettupPass2 */ +} /* SetupPass2 */ /*---------------------------------------------------------------------------*/ /** diff --git a/src/classify/classify.h b/src/classify/classify.h index 2225e5feab..e42d5674e3 100644 --- a/src/classify/classify.h +++ b/src/classify/classify.h @@ -243,8 +243,8 @@ class TESS_API Classify : public CCStruct { void DisplayAdaptedChar(TBLOB *blob, INT_CLASS_STRUCT *int_class); bool AdaptableWord(WERD_RES *word); void EndAdaptiveClassifier(); - void SettupPass1(); - void SettupPass2(); + void SetupPass1(); + void SetupPass2(); void AdaptiveClassifier(TBLOB *Blob, BLOB_CHOICE_LIST *Choices); void ClassifyAsNoise(ADAPT_RESULTS *Results); void ResetAdaptiveClassifierInternal(); diff --git a/src/dict/dict.h b/src/dict/dict.h index 136308153c..3290dd0bb0 100644 --- a/src/dict/dict.h +++ b/src/dict/dict.h @@ -267,9 +267,9 @@ class TESS_API Dict { /// Prints the current choices for this word to stdout. void DebugWordChoices(); /// Sets up stopper variables in preparation for the first pass. - void SettupStopperPass1(); + void SetupStopperPass1(); /// Sets up stopper variables in preparation for the second pass. - void SettupStopperPass2(); + void SetupStopperPass2(); /* context.cpp *************************************************************/ /// Check a string to see if it matches a set of lexical rules. int case_ok(const WERD_CHOICE &word) const; diff --git a/src/dict/stopper.cpp b/src/dict/stopper.cpp index 4c33fa89ce..a1885daf37 100644 --- a/src/dict/stopper.cpp +++ b/src/dict/stopper.cpp @@ -359,11 +359,11 @@ void Dict::EndDangerousAmbigs() {} #endif // !defined(DISABLED_LEGACY_ENGINE) -void Dict::SettupStopperPass1() { +void Dict::SetupStopperPass1() { reject_offset_ = 0.0; } -void Dict::SettupStopperPass2() { +void Dict::SetupStopperPass2() { reject_offset_ = stopper_phase2_certainty_rejection_offset; } diff --git a/src/wordrec/tface.cpp b/src/wordrec/tface.cpp index 06b9e9275a..107085d83c 100644 --- a/src/wordrec/tface.cpp +++ b/src/wordrec/tface.cpp @@ -97,7 +97,7 @@ int Wordrec::dict_word(const WERD_CHOICE &word) { void Wordrec::set_pass1() { chop_ok_split.set_value(70.0); language_model_->getParamsModel().SetPass(ParamsModel::PTRAIN_PASS1); - SettupPass1(); + SetupPass1(); } /** @@ -108,7 +108,7 @@ void Wordrec::set_pass1() { void Wordrec::set_pass2() { chop_ok_split.set_value(pass2_ok_split); language_model_->getParamsModel().SetPass(ParamsModel::PTRAIN_PASS2); - SettupPass2(); + SetupPass2(); } /** From 3400ce766230faaea5f21168403959164f5e3e23 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 23 Oct 2024 15:05:58 +0200 Subject: [PATCH 3/3] Fix more typos in code comments --- src/wordrec/language_model.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wordrec/language_model.h b/src/wordrec/language_model.h index 010cf5b4f4..98f90f748a 100644 --- a/src/wordrec/language_model.h +++ b/src/wordrec/language_model.h @@ -227,7 +227,7 @@ class LanguageModel { // (used by ComputeNgramCost()). float ComputeDenom(BLOB_CHOICE_LIST *curr_list); - // Fills the given consistenty_info based on parent_vse.consistency_info + // Fills the given consistency_info based on parent_vse.consistency_info // and on the consistency of the given unichar_id with parent_vse. void FillConsistencyInfo(int curr_col, bool word_end, BLOB_CHOICE *b, ViterbiStateEntry *parent_vse, WERD_RES *word_res,