20 #ifndef TESSERACT_CCUTIL_TESSDATAMANAGER_H_ 21 #define TESSERACT_CCUTIL_TESSDATAMANAGER_H_ 29 static const char kTrainedDataSuffix[] =
"traineddata";
33 static const char kLangConfigFileSuffix[] =
"config";
34 static const char kUnicharsetFileSuffix[] =
"unicharset";
35 static const char kAmbigsFileSuffix[] =
"unicharambigs";
36 static const char kBuiltInTemplatesFileSuffix[] =
"inttemp";
37 static const char kBuiltInCutoffsFileSuffix[] =
"pffmtable";
38 static const char kNormProtoFileSuffix[] =
"normproto";
39 static const char kPuncDawgFileSuffix[] =
"punc-dawg";
40 static const char kSystemDawgFileSuffix[] =
"word-dawg";
41 static const char kNumberDawgFileSuffix[] =
"number-dawg";
42 static const char kFreqDawgFileSuffix[] =
"freq-dawg";
43 static const char kFixedLengthDawgsFileSuffix[] =
"fixed-length-dawgs";
44 static const char kCubeUnicharsetFileSuffix[] =
"cube-unicharset";
45 static const char kCubeSystemDawgFileSuffix[] =
"cube-word-dawg";
46 static const char kShapeTableFileSuffix[] =
"shapetable";
47 static const char kBigramDawgFileSuffix[] =
"bigram-dawg";
48 static const char kUnambigDawgFileSuffix[] =
"unambig-dawg";
49 static const char kParamsModelFileSuffix[] =
"params-model";
50 static const char kLSTMModelFileSuffix[] =
"lstm";
51 static const char kLSTMPuncDawgFileSuffix[] =
"lstm-punc-dawg";
52 static const char kLSTMSystemDawgFileSuffix[] =
"lstm-word-dawg";
53 static const char kLSTMNumberDawgFileSuffix[] =
"lstm-number-dawg";
87 static const char *
const kTessdataFileSuffixes[] = {
88 kLangConfigFileSuffix,
89 kUnicharsetFileSuffix,
91 kBuiltInTemplatesFileSuffix,
92 kBuiltInCutoffsFileSuffix,
95 kSystemDawgFileSuffix,
96 kNumberDawgFileSuffix,
98 kFixedLengthDawgsFileSuffix,
99 kCubeUnicharsetFileSuffix,
100 kCubeSystemDawgFileSuffix,
101 kShapeTableFileSuffix,
102 kBigramDawgFileSuffix,
103 kUnambigDawgFileSuffix,
104 kParamsModelFileSuffix,
105 kLSTMModelFileSuffix,
106 kLSTMPuncDawgFileSuffix,
107 kLSTMSystemDawgFileSuffix,
108 kLSTMNumberDawgFileSuffix,
118 static const int kMaxNumTessdataEntries = 1000;
125 : reader_(reader), is_loaded_(false), swap_(false) {}
128 bool swap()
const {
return swap_; }
135 bool Init(
const char *data_file_name);
172 const char *output_filename);
180 char **component_filenames,
181 int num_new_components);
226 #endif // TESSERACT_CCUTIL_TESSDATAMANAGER_H_ bool OverwriteComponents(const char *new_traineddata_filename, char **component_filenames, int num_new_components)
bool IsLSTMAvailable() const
static bool TessdataTypeFromFileName(const char *filename, TessdataType *type)
TessdataManager(FileReader reader)
bool(* FileReader)(const STRING &filename, GenericVector< char > *data)
bool LoadMemBuffer(const char *name, const char *data, int size)
bool IsBaseAvailable() const
bool ExtractToFile(const char *filename)
bool SaveFile(const STRING &filename, FileWriter writer) const
bool GetComponent(TessdataType type, TFile *fp)
void Serialize(GenericVector< char > *data) const
bool(* FileWriter)(const GenericVector< char > &data, const STRING &filename)
static bool TessdataTypeFromFileSuffix(const char *suffix, TessdataType *type)
const STRING & GetDataFileName() const
bool CombineDataFiles(const char *language_data_path_prefix, const char *output_filename)
bool Init(const char *data_file_name)