tesseract  5.0.0-alpha-619-ge9db
tesseract::DawgLoader Struct Reference

Public Member Functions

 DawgLoader (const STRING &lang, TessdataType tessdata_dawg_type, int dawg_debug_level, TessdataManager *data_file)
 
DawgLoad ()
 

Public Attributes

STRING lang_
 
TessdataManagerdata_file_
 
TessdataType tessdata_dawg_type_
 
int dawg_debug_level_
 

Detailed Description

Definition at line 28 of file dawg_cache.cpp.

Constructor & Destructor Documentation

◆ DawgLoader()

tesseract::DawgLoader::DawgLoader ( const STRING lang,
TessdataType  tessdata_dawg_type,
int  dawg_debug_level,
TessdataManager data_file 
)
inline

Definition at line 29 of file dawg_cache.cpp.

31  : lang_(lang),
32  data_file_(data_file),
33  tessdata_dawg_type_(tessdata_dawg_type),
34  dawg_debug_level_(dawg_debug_level) {}

Member Function Documentation

◆ Load()

Dawg * tesseract::DawgLoader::Load ( )

Definition at line 53 of file dawg_cache.cpp.

53  {
54  TFile fp;
55  if (!data_file_->GetComponent(tessdata_dawg_type_, &fp)) return nullptr;
56  DawgType dawg_type;
57  PermuterType perm_type;
58  switch (tessdata_dawg_type_) {
59  case TESSDATA_PUNC_DAWG:
61  dawg_type = DAWG_TYPE_PUNCTUATION;
62  perm_type = PUNC_PERM;
63  break;
66  dawg_type = DAWG_TYPE_WORD;
67  perm_type = SYSTEM_DAWG_PERM;
68  break;
71  dawg_type = DAWG_TYPE_NUMBER;
72  perm_type = NUMBER_PERM;
73  break;
75  dawg_type = DAWG_TYPE_WORD; // doesn't actually matter
76  perm_type = COMPOUND_PERM; // doesn't actually matter
77  break;
79  dawg_type = DAWG_TYPE_WORD;
80  perm_type = SYSTEM_DAWG_PERM;
81  break;
82  case TESSDATA_FREQ_DAWG:
83  dawg_type = DAWG_TYPE_WORD;
84  perm_type = FREQ_DAWG_PERM;
85  break;
86  default:
87  return nullptr;
88  }
89  auto *retval =
90  new SquishedDawg(dawg_type, lang_, perm_type, dawg_debug_level_);
91  if (retval->Load(&fp)) return retval;
92  delete retval;
93  return nullptr;
94 }

Member Data Documentation

◆ data_file_

TessdataManager* tesseract::DawgLoader::data_file_

Definition at line 39 of file dawg_cache.cpp.

◆ dawg_debug_level_

int tesseract::DawgLoader::dawg_debug_level_

Definition at line 41 of file dawg_cache.cpp.

◆ lang_

STRING tesseract::DawgLoader::lang_

Definition at line 38 of file dawg_cache.cpp.

◆ tessdata_dawg_type_

TessdataType tesseract::DawgLoader::tessdata_dawg_type_

Definition at line 40 of file dawg_cache.cpp.


The documentation for this struct was generated from the following file:
tesseract::DAWG_TYPE_PUNCTUATION
Definition: dawg.h:67
tesseract::TESSDATA_SYSTEM_DAWG
Definition: tessdatamanager.h:64
tesseract::TESSDATA_BIGRAM_DAWG
Definition: tessdatamanager.h:71
SYSTEM_DAWG_PERM
Definition: ratngs.h:239
PermuterType
PermuterType
Definition: ratngs.h:230
tesseract::DAWG_TYPE_NUMBER
Definition: dawg.h:69
COMPOUND_PERM
Definition: ratngs.h:243
tesseract::DawgLoader::tessdata_dawg_type_
TessdataType tessdata_dawg_type_
Definition: dawg_cache.cpp:40
tesseract::TESSDATA_LSTM_SYSTEM_DAWG
Definition: tessdatamanager.h:76
tesseract::DAWG_TYPE_WORD
Definition: dawg.h:68
tesseract::DawgLoader::dawg_debug_level_
int dawg_debug_level_
Definition: dawg_cache.cpp:41
tesseract::TESSDATA_PUNC_DAWG
Definition: tessdatamanager.h:63
tesseract::DawgLoader::data_file_
TessdataManager * data_file_
Definition: dawg_cache.cpp:39
tesseract::TessdataManager::GetComponent
bool GetComponent(TessdataType type, TFile *fp)
Definition: tessdatamanager.cpp:216
tesseract::TESSDATA_LSTM_NUMBER_DAWG
Definition: tessdatamanager.h:77
tesseract::DawgType
DawgType
Definition: dawg.h:66
tesseract::DawgLoader::lang_
STRING lang_
Definition: dawg_cache.cpp:38
tesseract::TESSDATA_UNAMBIG_DAWG
Definition: tessdatamanager.h:72
tesseract::TESSDATA_LSTM_PUNC_DAWG
Definition: tessdatamanager.h:75
PUNC_PERM
Definition: ratngs.h:232
FREQ_DAWG_PERM
Definition: ratngs.h:242
tesseract::TESSDATA_NUMBER_DAWG
Definition: tessdatamanager.h:65
NUMBER_PERM
Definition: ratngs.h:237
tesseract::TESSDATA_FREQ_DAWG
Definition: tessdatamanager.h:66