32 static const char kUnknownFontName[] =
"UnknownFont";
35 "Default font name to be used in training");
48 if (*fontname == kUnknownFontName) {
51 const char *basename = strrchr(
filename.string(),
'/');
52 const char *firstdot = strchr(basename ? basename :
filename.string(),
'.');
53 const char *lastdot = strrchr(
filename.string(),
'.');
54 if (firstdot != lastdot && firstdot != NULL && lastdot != NULL) {
72 const char* blob_text) {
81 tr_file_data_ +=
"\n";
82 tr_file_data_ += fontname;
84 tr_file_data_ += blob_text;
85 tr_file_data_ +=
"\n";
90 tprintf(
"Blob learned was invalid!\n");
100 int len = tr_file_data_.
length();
102 fwrite(&tr_file_data_[0],
sizeof(tr_file_data_[0]), len, fp) == len;
FEATURE_SET ExtractCharNormFeatures(const INT_FX_RESULT_STRUCT &fx_info)
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]
FEATURE_DEFS_STRUCT feature_defs_
CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs)
FEATURE_SET ExtractIntCNFeatures(const TBLOB &blob, const INT_FX_RESULT_STRUCT &fx_info)
#define STRING_VAR(name, val, comment)
void truncate_at(inT32 index)
const char * string() const
FEATURE_SET ExtractIntGeoFeatures(const TBLOB &blob, const INT_FX_RESULT_STRUCT &fx_info)
void LearnBlob(const STRING &fontname, TBLOB *Blob, const DENORM &cn_denorm, const INT_FX_RESULT_STRUCT &fx_info, const char *blob_text)
FILE * Efopen(const char *Name, const char *Mode)
void ExtractFontName(const STRING &filename, STRING *fontname)
bool WriteTRFile(const STRING &filename)
bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc)
void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc, STRING *str)
FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM &cn_denorm)
void FreeCharDescription(CHAR_DESC CharDesc)
char * classify_font_name