tesseract  3.05.02
tesseract::DawgLoader Struct Reference

Public Member Functions

 DawgLoader (const STRING &lang, const char *data_file_name, TessdataType tessdata_dawg_type, int dawg_debug_level)
 
DawgLoad ()
 

Public Attributes

STRING lang_
 
const char * data_file_name_
 
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,
const char *  data_file_name,
TessdataType  tessdata_dawg_type,
int  dawg_debug_level 
)
inline

Definition at line 30 of file dawg_cache.cpp.

34  : lang_(lang),
35  data_file_name_(data_file_name),
36  tessdata_dawg_type_(tessdata_dawg_type),
37  dawg_debug_level_(dawg_debug_level) {}
TessdataType tessdata_dawg_type_
Definition: dawg_cache.cpp:43
const char * data_file_name_
Definition: dawg_cache.cpp:42

Member Function Documentation

◆ Load()

Dawg * tesseract::DawgLoader::Load ( )

Definition at line 58 of file dawg_cache.cpp.

58  {
59  TessdataManager data_loader;
60  if (!data_loader.Init(data_file_name_, dawg_debug_level_)) {
61  return NULL;
62  }
63  if (!data_loader.SeekToStart(tessdata_dawg_type_)) {
64  data_loader.End();
65  return NULL;
66  }
67  FILE *fp = data_loader.GetDataFilePtr();
68  DawgType dawg_type;
69  PermuterType perm_type;
70  switch (tessdata_dawg_type_) {
71  case TESSDATA_PUNC_DAWG:
72  dawg_type = DAWG_TYPE_PUNCTUATION;
73  perm_type = PUNC_PERM;
74  break;
76  dawg_type = DAWG_TYPE_WORD;
77  perm_type = SYSTEM_DAWG_PERM;
78  break;
80  dawg_type = DAWG_TYPE_NUMBER;
81  perm_type = NUMBER_PERM;
82  break;
84  dawg_type = DAWG_TYPE_WORD; // doesn't actually matter
85  perm_type = COMPOUND_PERM; // doesn't actually matter
86  break;
88  dawg_type = DAWG_TYPE_WORD;
89  perm_type = SYSTEM_DAWG_PERM;
90  break;
91  case TESSDATA_FREQ_DAWG:
92  dawg_type = DAWG_TYPE_WORD;
93  perm_type = FREQ_DAWG_PERM;
94  break;
95  default:
96  data_loader.End();
97  return NULL;
98  }
99  SquishedDawg *retval =
100  new SquishedDawg(fp, dawg_type, lang_, perm_type, dawg_debug_level_);
101  data_loader.End();
102  return retval;
103 }
PermuterType
Definition: ratngs.h:240
DawgType
Definition: dawg.h:71
TessdataType tessdata_dawg_type_
Definition: dawg_cache.cpp:43
const char * data_file_name_
Definition: dawg_cache.cpp:42

Member Data Documentation

◆ data_file_name_

const char* tesseract::DawgLoader::data_file_name_

Definition at line 42 of file dawg_cache.cpp.

◆ dawg_debug_level_

int tesseract::DawgLoader::dawg_debug_level_

Definition at line 44 of file dawg_cache.cpp.

◆ lang_

STRING tesseract::DawgLoader::lang_

Definition at line 41 of file dawg_cache.cpp.

◆ tessdata_dawg_type_

TessdataType tesseract::DawgLoader::tessdata_dawg_type_

Definition at line 43 of file dawg_cache.cpp.


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