20 #ifndef TESSERACT_CCUTIL_TESSDATAMANAGER_H_ 21 #define TESSERACT_CCUTIL_TESSDATAMANAGER_H_ 25 static const char kTrainedDataSuffix[] =
"traineddata";
29 static const char kLangConfigFileSuffix[] =
"config";
30 static const char kUnicharsetFileSuffix[] =
"unicharset";
31 static const char kAmbigsFileSuffix[] =
"unicharambigs";
32 static const char kBuiltInTemplatesFileSuffix[] =
"inttemp";
33 static const char kBuiltInCutoffsFileSuffix[] =
"pffmtable";
34 static const char kNormProtoFileSuffix[] =
"normproto";
35 static const char kPuncDawgFileSuffix[] =
"punc-dawg";
36 static const char kSystemDawgFileSuffix[] =
"word-dawg";
37 static const char kNumberDawgFileSuffix[] =
"number-dawg";
38 static const char kFreqDawgFileSuffix[] =
"freq-dawg";
39 static const char kFixedLengthDawgsFileSuffix[] =
"fixed-length-dawgs";
40 static const char kCubeUnicharsetFileSuffix[] =
"cube-unicharset";
41 static const char kCubeSystemDawgFileSuffix[] =
"cube-word-dawg";
42 static const char kShapeTableFileSuffix[] =
"shapetable";
43 static const char kBigramDawgFileSuffix[] =
"bigram-dawg";
44 static const char kUnambigDawgFileSuffix[] =
"unambig-dawg";
45 static const char kParamsModelFileSuffix[] =
"params-model";
46 static const char kLSTMModelFileSuffix[] =
"lstm";
47 static const char kLSTMPuncDawgFileSuffix[] =
"lstm-punc-dawg";
48 static const char kLSTMSystemDawgFileSuffix[] =
"lstm-word-dawg";
49 static const char kLSTMNumberDawgFileSuffix[] =
"lstm-number-dawg";
50 static const char kLSTMUnicharsetFileSuffix[] =
"lstm-unicharset";
51 static const char kLSTMRecoderFileSuffix[] =
"lstm-recoder";
52 static const char kVersionFileSuffix[] =
"version";
89 static const char *
const kTessdataFileSuffixes[] = {
90 kLangConfigFileSuffix,
91 kUnicharsetFileSuffix,
93 kBuiltInTemplatesFileSuffix,
94 kBuiltInCutoffsFileSuffix,
97 kSystemDawgFileSuffix,
98 kNumberDawgFileSuffix,
100 kFixedLengthDawgsFileSuffix,
101 kCubeUnicharsetFileSuffix,
102 kCubeSystemDawgFileSuffix,
103 kShapeTableFileSuffix,
104 kBigramDawgFileSuffix,
105 kUnambigDawgFileSuffix,
106 kParamsModelFileSuffix,
107 kLSTMModelFileSuffix,
108 kLSTMPuncDawgFileSuffix,
109 kLSTMSystemDawgFileSuffix,
110 kLSTMNumberDawgFileSuffix,
111 kLSTMUnicharsetFileSuffix,
112 kLSTMRecoderFileSuffix,
123 static const int kMaxNumTessdataEntries = 1000;
133 bool swap()
const {
return swap_; }
143 bool Init(
const char *data_file_name);
146 bool LoadMemBuffer(
const char *name,
const char *data,
int size);
162 return !entries_[type].
empty();
194 const char *output_filename);
202 char **component_filenames,
203 int num_new_components);
248 #endif // TESSERACT_CCUTIL_TESSDATAMANAGER_H_
static bool TessdataTypeFromFileName(const char *filename, TessdataType *type)
void SetVersionString(const std::string &v_str)
bool IsLSTMAvailable() const
bool CombineDataFiles(const char *language_data_path_prefix, const char *output_filename)
bool GetComponent(TessdataType type, TFile *fp)
~TessdataManager()=default
void OverwriteEntry(TessdataType type, const char *data, int size)
bool LoadMemBuffer(const char *name, const char *data, int size)
void LoadFileLater(const char *data_file_name)
bool OverwriteComponents(const char *new_traineddata_filename, char **component_filenames, int num_new_components)
const STRING & GetDataFileName() const
bool Init(const char *data_file_name)
bool(* FileReader)(const STRING &filename, GenericVector< char > *data)
static bool TessdataTypeFromFileSuffix(const char *suffix, TessdataType *type)
void Serialize(GenericVector< char > *data) const
bool SaveFile(const STRING &filename, FileWriter writer) const
std::string VersionString() const
bool ExtractToFile(const char *filename)
bool IsBaseAvailable() const
bool(* FileWriter)(const GenericVector< char > &data, const STRING &filename)
bool IsComponentAvailable(TessdataType type) const