tesseract  4.0.0-1-g2a2b
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 29 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 30 of file dawg_cache.cpp.

32  : lang_(lang),
33  data_file_(data_file),
34  tessdata_dawg_type_(tessdata_dawg_type),
35  dawg_debug_level_(dawg_debug_level) {}
TessdataManager * data_file_
Definition: dawg_cache.cpp:40
TessdataType tessdata_dawg_type_
Definition: dawg_cache.cpp:41

Member Function Documentation

◆ Load()

Dawg * tesseract::DawgLoader::Load ( )

Definition at line 54 of file dawg_cache.cpp.

54  {
55  TFile fp;
56  if (!data_file_->GetComponent(tessdata_dawg_type_, &fp)) return nullptr;
57  DawgType dawg_type;
58  PermuterType perm_type;
59  switch (tessdata_dawg_type_) {
60  case TESSDATA_PUNC_DAWG:
62  dawg_type = DAWG_TYPE_PUNCTUATION;
63  perm_type = PUNC_PERM;
64  break;
67  dawg_type = DAWG_TYPE_WORD;
68  perm_type = SYSTEM_DAWG_PERM;
69  break;
72  dawg_type = DAWG_TYPE_NUMBER;
73  perm_type = NUMBER_PERM;
74  break;
76  dawg_type = DAWG_TYPE_WORD; // doesn't actually matter
77  perm_type = COMPOUND_PERM; // doesn't actually matter
78  break;
80  dawg_type = DAWG_TYPE_WORD;
81  perm_type = SYSTEM_DAWG_PERM;
82  break;
83  case TESSDATA_FREQ_DAWG:
84  dawg_type = DAWG_TYPE_WORD;
85  perm_type = FREQ_DAWG_PERM;
86  break;
87  default:
88  return nullptr;
89  }
90  SquishedDawg *retval =
91  new SquishedDawg(dawg_type, lang_, perm_type, dawg_debug_level_);
92  if (retval->Load(&fp)) return retval;
93  delete retval;
94  return nullptr;
95 }
bool GetComponent(TessdataType type, TFile *fp)
TessdataManager * data_file_
Definition: dawg_cache.cpp:40
TessdataType tessdata_dawg_type_
Definition: dawg_cache.cpp:41
DawgType
Definition: dawg.h:72
PermuterType
Definition: ratngs.h:242

Member Data Documentation

◆ data_file_

TessdataManager* tesseract::DawgLoader::data_file_

Definition at line 40 of file dawg_cache.cpp.

◆ dawg_debug_level_

int tesseract::DawgLoader::dawg_debug_level_

Definition at line 42 of file dawg_cache.cpp.

◆ lang_

STRING tesseract::DawgLoader::lang_

Definition at line 39 of file dawg_cache.cpp.

◆ tessdata_dawg_type_

TessdataType tesseract::DawgLoader::tessdata_dawg_type_

Definition at line 41 of file dawg_cache.cpp.


The documentation for this struct was generated from the following file: