Skip to content

Commit

Permalink
Merge pull request #3609 from stweil/api
Browse files Browse the repository at this point in the history
Remove TessBaseAPI::InitLangMod (API change)
  • Loading branch information
zdenop authored Oct 26, 2021
2 parents 255d7c9 + c2df9ce commit 48c5d42
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 51 deletions.
8 changes: 0 additions & 8 deletions include/tesseract/baseapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,6 @@ class TESS_API TessBaseAPI {
*/
void GetAvailableLanguagesAsVector(std::vector<std::string> *langs) const;

/**
* Init only the lang model component of Tesseract. The only functions
* that work after this init are SetVariable and IsValidWord.
* WARNING: temporary! This function will be removed from here and placed
* in a separate API at some future time.
*/
int InitLangMod(const char *datapath, const char *language);

/**
* Init only for page layout analysis. Use only for calls to SetImage and
* AnalysePage. Calls that attempt recognition will generate an error.
Expand Down
2 changes: 0 additions & 2 deletions include/tesseract/capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ TESS_API char **TessBaseAPIGetLoadedLanguagesAsVector(
TESS_API char **TessBaseAPIGetAvailableLanguagesAsVector(
const TessBaseAPI *handle);

TESS_API int TessBaseAPIInitLangMod(TessBaseAPI *handle, const char *datapath,
const char *language);
TESS_API void TessBaseAPIInitForAnalysePage(TessBaseAPI *handle);

TESS_API void TessBaseAPIReadConfigFile(TessBaseAPI *handle,
Expand Down
19 changes: 0 additions & 19 deletions src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,25 +474,6 @@ void TessBaseAPI::GetAvailableLanguagesAsVector(std::vector<std::string> *langs)
}
}

// TODO(amit): Adapt to lstm
#ifndef DISABLED_LEGACY_ENGINE
/**
* Init only the lang model component of Tesseract. The only functions
* that work after this init are SetVariable and IsValidWord.
* WARNING: temporary! This function will be removed from here and placed
* in a separate API at some future time.
*/
int TessBaseAPI::InitLangMod(const char *datapath, const char *language) {
if (tesseract_ == nullptr) {
tesseract_ = new Tesseract;
} else {
ParamUtils::ResetToDefaults(tesseract_->params());
}
TessdataManager mgr;
return tesseract_->init_tesseract_lm(datapath, nullptr, language, &mgr);
}
#endif // ndef DISABLED_LEGACY_ENGINE

/**
* Init only for page layout analysis. Use only for calls to SetImage and
* AnalysePage. Calls that attempt recognition will generate an error.
Expand Down
6 changes: 0 additions & 6 deletions src/api/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,6 @@ char **TessBaseAPIGetAvailableLanguagesAsVector(const TessBaseAPI *handle) {
return arr;
}

#ifndef DISABLED_LEGACY_ENGINE
int TessBaseAPIInitLangMod(TessBaseAPI *handle, const char *datapath, const char *language) {
return handle->InitLangMod(datapath, language);
}
#endif

void TessBaseAPIInitForAnalysePage(TessBaseAPI *handle) {
handle->InitForAnalysePage();
}
Expand Down
13 changes: 0 additions & 13 deletions src/ccmain/tessedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,6 @@ void Tesseract::SetupUniversalFontIds() {
font_table_size_ = all_fonts.size();
}

// init the LM component
int Tesseract::init_tesseract_lm(const std::string &arg0, const std::string &textbase,
const std::string &language, TessdataManager *mgr) {
if (!init_tesseract_lang_data(arg0, textbase, language, OEM_TESSERACT_ONLY, nullptr, 0, nullptr,
nullptr, false, mgr)) {
return -1;
}
getDict().SetupForLoad(Dict::GlobalDawgCache());
getDict().Load(lang, mgr);
getDict().FinishLoad();
return 0;
}

#endif // ndef DISABLED_LEGACY_ENGINE

void Tesseract::end_tesseract() {
Expand Down
3 changes: 0 additions & 3 deletions src/ccmain/tesseractclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,6 @@ class TESS_API Tesseract : public Wordrec {
// instances of the same font loaded.
void SetupUniversalFontIds();

int init_tesseract_lm(const std::string &arg0, const std::string &textbase,
const std::string &language, TessdataManager *mgr);

void recognize_page(std::string &image_name);
void end_tesseract();

Expand Down

0 comments on commit 48c5d42

Please sign in to comment.