53 #define offset_table_entries \ 54 255, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, \ 55 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, \ 56 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, \ 57 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, \ 58 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, \ 59 0, 1, 0, 2, 0, 1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, \ 60 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, \ 61 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, \ 62 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, \ 63 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, \ 64 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 66 #define INTMATCHER_OFFSET_TABLE_SIZE 256 68 #define next_table_entries \ 69 0, 0, 0, 0x2, 0, 0x4, 0x4, 0x6, 0, 0x8, 0x8, 0x0a, 0x08, 0x0c, 0x0c, 0x0e, \ 70 0, 0x10, 0x10, 0x12, 0x10, 0x14, 0x14, 0x16, 0x10, 0x18, 0x18, 0x1a, \ 71 0x18, 0x1c, 0x1c, 0x1e, 0, 0x20, 0x20, 0x22, 0x20, 0x24, 0x24, 0x26, \ 72 0x20, 0x28, 0x28, 0x2a, 0x28, 0x2c, 0x2c, 0x2e, 0x20, 0x30, 0x30, 0x32, \ 73 0x30, 0x34, 0x34, 0x36, 0x30, 0x38, 0x38, 0x3a, 0x38, 0x3c, 0x3c, 0x3e, \ 74 0, 0x40, 0x40, 0x42, 0x40, 0x44, 0x44, 0x46, 0x40, 0x48, 0x48, 0x4a, \ 75 0x48, 0x4c, 0x4c, 0x4e, 0x40, 0x50, 0x50, 0x52, 0x50, 0x54, 0x54, 0x56, \ 76 0x50, 0x58, 0x58, 0x5a, 0x58, 0x5c, 0x5c, 0x5e, 0x40, 0x60, 0x60, 0x62, \ 77 0x60, 0x64, 0x64, 0x66, 0x60, 0x68, 0x68, 0x6a, 0x68, 0x6c, 0x6c, 0x6e, \ 78 0x60, 0x70, 0x70, 0x72, 0x70, 0x74, 0x74, 0x76, 0x70, 0x78, 0x78, 0x7a, \ 79 0x78, 0x7c, 0x7c, 0x7e, 0, 0x80, 0x80, 0x82, 0x80, 0x84, 0x84, 0x86, \ 80 0x80, 0x88, 0x88, 0x8a, 0x88, 0x8c, 0x8c, 0x8e, 0x80, 0x90, 0x90, 0x92, \ 81 0x90, 0x94, 0x94, 0x96, 0x90, 0x98, 0x98, 0x9a, 0x98, 0x9c, 0x9c, 0x9e, \ 82 0x80, 0xa0, 0xa0, 0xa2, 0xa0, 0xa4, 0xa4, 0xa6, 0xa0, 0xa8, 0xa8, 0xaa, \ 83 0xa8, 0xac, 0xac, 0xae, 0xa0, 0xb0, 0xb0, 0xb2, 0xb0, 0xb4, 0xb4, 0xb6, \ 84 0xb0, 0xb8, 0xb8, 0xba, 0xb8, 0xbc, 0xbc, 0xbe, 0x80, 0xc0, 0xc0, 0xc2, \ 85 0xc0, 0xc4, 0xc4, 0xc6, 0xc0, 0xc8, 0xc8, 0xca, 0xc8, 0xcc, 0xcc, 0xce, \ 86 0xc0, 0xd0, 0xd0, 0xd2, 0xd0, 0xd4, 0xd4, 0xd6, 0xd0, 0xd8, 0xd8, 0xda, \ 87 0xd8, 0xdc, 0xdc, 0xde, 0xc0, 0xe0, 0xe0, 0xe2, 0xe0, 0xe4, 0xe4, 0xe6, \ 88 0xe0, 0xe8, 0xe8, 0xea, 0xe8, 0xec, 0xec, 0xee, 0xe0, 0xf0, 0xf0, 0xf2, \ 89 0xf0, 0xf4, 0xf4, 0xf6, 0xf0, 0xf8, 0xf8, 0xfa, 0xf8, 0xfc, 0xfc, 0xfe 95 static const uinT8*
const offset_table = &data_table[0];
96 static const uinT8*
const next_table =
116 max_classes_ = max_classes;
119 class_count_ =
new int[rounded_classes_];
120 norm_count_ =
new int[rounded_classes_];
121 sort_key_ =
new int[rounded_classes_ + 1];
122 sort_index_ =
new int[rounded_classes_ + 1];
123 for (
int i = 0; i < rounded_classes_; i++) {
126 pruning_threshold_ = 0;
132 delete []class_count_;
133 delete []norm_count_;
135 delete []sort_index_;
142 num_features_ = num_features;
144 for (
int f = 0; f < num_features; ++f) {
153 for (
int pruner_set = 0; pruner_set < num_pruners; ++pruner_set) {
156 const uinT32* pruner_word_ptr =
159 uinT32 pruner_word = *pruner_word_ptr++;
212 int cutoff_strength) {
213 for (
int class_id = 0; class_id < max_classes_; ++class_id) {
214 if (num_features_ < expected_num_features[class_id]) {
215 int deficit = expected_num_features[class_id] - num_features_;
216 class_count_[class_id] -= class_count_[class_id] * deficit /
217 (num_features_ * cutoff_strength + deficit);
225 for (
int class_id = 0; class_id < max_classes_; ++class_id) {
227 class_count_[class_id] = 0;
233 for (
int class_id = 0; class_id < max_classes_; ++class_id) {
237 class_count_[class_id] = 0;
247 const uinT8* normalization_factors) {
248 for (
int class_id = 0; class_id < max_classes_; class_id++) {
249 norm_count_[class_id] = class_count_[class_id] -
250 ((norm_multiplier * normalization_factors[class_id]) >> 8);
256 for (
int class_id = 0; class_id < max_classes_; class_id++) {
257 norm_count_[class_id] = class_count_[class_id];
265 bool max_of_non_fragments,
const UNICHARSET& unicharset) {
267 for (
int c = 0; c < max_classes_; ++c) {
268 if (norm_count_[c] > max_count &&
274 (!max_of_non_fragments || !unicharset.
get_fragment(c))) {
275 max_count = norm_count_[c];
279 pruning_threshold_ = (max_count * pruning_factor) >> 8;
281 if (pruning_threshold_ < 1)
282 pruning_threshold_ = 1;
284 for (
int class_id = 0; class_id < max_classes_; class_id++) {
285 if (norm_count_[class_id] >= pruning_threshold_ ||
286 class_id == keep_this) {
288 sort_index_[num_classes_] = class_id;
289 sort_key_[num_classes_] = norm_count_[class_id];
294 if (num_classes_ > 1)
295 HeapSort(num_classes_, sort_key_, sort_index_);
304 int max_num_classes = int_templates->
NumClasses;
305 for (
int f = 0; f < num_features_; ++f) {
307 tprintf(
"F=%3d(%d,%d,%d),", f, feature->
X, feature->
Y, feature->
Theta);
313 for (
int pruner_set = 0; pruner_set < num_pruners; ++pruner_set) {
316 const uinT32* pruner_word_ptr =
319 uinT32 pruner_word = *pruner_word_ptr++;
320 for (
int word_class = 0; word_class < 16 &&
321 class_id < max_num_classes; ++word_class, ++class_id) {
322 if (norm_count_[class_id] >= pruning_threshold_) {
339 const uinT16* expected_num_features,
341 const uinT8* normalization_factors)
const {
342 tprintf(
"CP:%d classes, %d features:\n", num_classes_, num_features_);
343 for (
int i = 0; i < num_classes_; ++i) {
344 int class_id = sort_index_[num_classes_ - i];
347 tprintf(
"%s:Initial=%d, E=%d, Xht-adj=%d, N=%d, Rat=%.2f\n",
349 class_count_[class_id],
350 expected_num_features[class_id],
351 (norm_multiplier * normalization_factors[class_id]) >> 8,
352 sort_key_[num_classes_ - i],
353 100.0 - 100.0 * sort_key_[num_classes_ - i] /
363 for (
int c = 0; c < num_classes_; ++c) {
364 (*results)[c].Class = sort_index_[num_classes_ - c];
365 (*results)[c].Rating = 1.0 - sort_key_[num_classes_ - c] /
385 int rounded_classes_;
387 int pruning_threshold_;
413 int num_features,
int keep_this,
415 const uinT8* normalization_factors,
416 const uinT16* expected_num_features,
432 if (normalization_factors != NULL) {
434 normalization_factors);
443 pruner.
DebugMatch(*
this, int_templates, features);
448 normalization_factors);
481 int AdaptFeatureThreshold,
483 bool SeparateDebugWindows) {
489 cprintf (
"Integer Matcher -------------------------------------------\n");
491 tables->
Clear(ClassTemplate);
494 for (Feature = 0; Feature < NumFeatures; Feature++) {
495 int csum = UpdateTablesForFeature(ClassTemplate, ProtoMask, ConfigMask,
496 Feature, &Features[Feature],
503 #ifndef GRAPHICS_DISABLED 505 DebugFeatureProtoError(ClassTemplate, ProtoMask, ConfigMask, *tables,
510 DisplayProtoDebugInfo(ClassTemplate, ProtoMask, ConfigMask,
511 *tables, SeparateDebugWindows);
515 DisplayFeatureDebugInfo(ClassTemplate, ProtoMask, ConfigMask, NumFeatures,
516 Features, AdaptFeatureThreshold, Debug,
517 SeparateDebugWindows);
522 tables->
NormalizeSums(ClassTemplate, NumFeatures, NumFeatures);
524 BestMatch = FindBestMatch(ClassTemplate, *tables, Result);
526 #ifndef GRAPHICS_DISABLED 531 cprintf(
"Match Complete --------------------------------------------\n");
565 int AdaptProtoThreshold,
568 int NumGoodProtos = 0;
573 (
"Find Good Protos -------------------------------------------\n");
575 tables->
Clear(ClassTemplate);
577 for (
int Feature = 0; Feature < NumFeatures; Feature++)
578 UpdateTablesForFeature(
579 ClassTemplate, ProtoMask, ConfigMask, Feature, &(Features[Feature]),
582 #ifndef GRAPHICS_DISABLED 584 DebugFeatureProtoError(ClassTemplate, ProtoMask, ConfigMask, *tables,
589 for (
int proto = 0; proto < ClassTemplate->
NumProtos; proto++) {
592 for (
int i = 0; i < ClassTemplate->
ProtoLengths[proto]; i++)
598 if (Temp >= AdaptProtoThreshold) {
606 cprintf (
"Match Complete --------------------------------------------\n");
609 return NumGoodProtos;
635 int AdaptFeatureThreshold,
638 int NumBadFeatures = 0;
642 cprintf(
"Find Bad Features -------------------------------------------\n");
644 tables->
Clear(ClassTemplate);
646 for (
int Feature = 0; Feature < NumFeatures; Feature++) {
647 UpdateTablesForFeature(
648 ClassTemplate, ProtoMask, ConfigMask, Feature, &Features[Feature],
653 for (
int i = 0; i < ClassTemplate->
NumConfigs; i++)
658 if (best < AdaptFeatureThreshold) {
659 *FeatureArray = Feature;
665 #ifndef GRAPHICS_DISABLED 667 DebugFeatureProtoError(ClassTemplate, ProtoMask, ConfigMask, *tables,
672 cprintf(
"Match Complete --------------------------------------------\n");
675 return NumBadFeatures;
680 classify_debug_level_ = classify_debug_level;
685 double Similarity = ((double) IntSimilarity) / 65536.0 / 65536.0;
687 evidence = 255.0 / (evidence * evidence + 1.0);
695 similarity_evidence_table_[i] = (
uinT8) (evidence + 0.5);
699 evidence_table_mask_ =
702 table_trunc_shift_bits_ = (27 -
SE_TABLE_BITS - (mult_trunc_shift_bits_ << 1));
732 cprintf (
"F = %3d, P = %3d, E = %3d, Configs = ",
733 FeatureNum, (
int) ActualProtoNum, (
int) Evidence);
751 uinT8 *FeatureEvidence,
753 cprintf(
"F=%3d, C=", FeatureNum);
754 for (
int ConfigNum = 0; ConfigNum < ConfigCount; ConfigNum++) {
755 cprintf(
"%4d", FeatureEvidence[ConfigNum]);
771 int IntegerMatcher::UpdateTablesForFeature(
784 inT32 proto_word_offset;
795 uinT32 ThetaFeatureAddress;
808 XFeatureAddress = ((Feature->
X >> 2) << 1);
812 for (ProtoSetIndex = 0, ActualProtoNum = 0;
813 ProtoSetIndex < ClassTemplate->
NumProtoSets; ProtoSetIndex++) {
814 ProtoSet = ClassTemplate->
ProtoSets[ProtoSetIndex];
815 ProtoPrunerPtr = (
uinT32 *) ((*ProtoSet).ProtoPruner);
820 ProtoWord = *(ProtoPrunerPtr + XFeatureAddress);
821 ProtoWord &= *(ProtoPrunerPtr + YFeatureAddress);
822 ProtoWord &= *(ProtoPrunerPtr + ThetaFeatureAddress);
823 ProtoWord &= *ProtoMask;
825 if (ProtoWord != 0) {
826 proto_byte = ProtoWord & 0xff;
828 proto_word_offset = 0;
829 while (ProtoWord != 0 || proto_byte != 0) {
830 while (proto_byte == 0) {
831 proto_byte = ProtoWord & 0xff;
833 proto_word_offset += 8;
835 proto_offset = offset_table[proto_byte] + proto_word_offset;
836 proto_byte = next_table[proto_byte];
837 Proto = &(ProtoSet->
Protos[ProtoNum + proto_offset]);
838 ConfigWord = Proto->
Configs[0];
839 A3 = (((Proto->
A * (Feature->
X - 128)) << 1)
840 - (Proto->
B * (Feature->
Y - 128)) + (Proto->
C << 9));
848 A3 >>= mult_trunc_shift_bits_;
849 M3 >>= mult_trunc_shift_bits_;
850 if (A3 > evidence_mult_mask_)
851 A3 = evidence_mult_mask_;
852 if (M3 > evidence_mult_mask_)
853 M3 = evidence_mult_mask_;
855 A4 = (A3 * A3) + (M3 * M3);
856 A4 >>= table_trunc_shift_bits_;
857 if (A4 > evidence_table_mask_)
860 Evidence = similarity_evidence_table_[A4];
864 ActualProtoNum + proto_offset,
865 Evidence, ConfigMask, ConfigWord);
867 ConfigWord &= *ConfigMask;
871 while (ConfigWord != 0 || config_byte != 0) {
872 while (config_byte == 0) {
873 config_byte = ConfigWord & 0xff;
877 config_offset = offset_table[config_byte];
878 config_byte = next_table[config_byte];
879 if (Evidence > UINT8Pointer[config_offset])
880 UINT8Pointer[config_offset] = Evidence;
886 ClassTemplate->
ProtoLengths[ActualProtoNum + proto_offset];
887 ProtoIndex > 0; ProtoIndex--, UINT8Pointer++) {
888 if (Evidence > *UINT8Pointer) {
889 Temp = *UINT8Pointer;
890 *UINT8Pointer = Evidence;
893 else if (Evidence == 0)
908 int SumOverConfigs = 0;
909 for (ConfigNum = ClassTemplate->
NumConfigs; ConfigNum > 0; ConfigNum--) {
910 int evidence = *UINT8Pointer++;
911 SumOverConfigs += evidence;
912 *IntPointer++ += evidence;
914 return SumOverConfigs;
923 #ifndef GRAPHICS_DISABLED 924 void IntegerMatcher::DebugFeatureProtoError(
941 cprintf(
"Configuration Mask:\n");
942 for (ConfigNum = 0; ConfigNum < ClassTemplate->
NumConfigs; ConfigNum++)
943 cprintf(
"%1d", (((*ConfigMask) >> ConfigNum) & 1));
946 cprintf(
"Feature Error for Configurations:\n");
947 for (ConfigNum = 0; ConfigNum < ClassTemplate->
NumConfigs; ConfigNum++) {
952 / NumFeatures / 256.0));
959 for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->
NumProtoSets;
962 for (ProtoWordNum = 0; ProtoWordNum < 2;
963 ProtoWordNum++, ProtoMask++) {
966 ((ProtoNum < (PROTOS_PER_PROTO_SET >> 1))
967 && (ActualProtoNum < ClassTemplate->
NumProtos));
968 ProtoNum++, ActualProtoNum++)
969 cprintf (
"%1d", (((*ProtoMask) >> ProtoNum) & 1));
976 for (
int i = 0; i < ClassTemplate->
NumConfigs; i++)
981 for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->
NumProtoSets;
983 ProtoSet = ClassTemplate->
ProtoSets[ProtoSetIndex];
987 (ActualProtoNum < ClassTemplate->NumProtos));
988 ProtoNum++, ActualProtoNum++) {
989 cprintf (
"P %3d =", ActualProtoNum);
991 for (
int j = 0; j < ClassTemplate->
ProtoLengths[ActualProtoNum]; j++) {
998 temp / 256.0 / ClassTemplate->
ProtoLengths[ActualProtoNum]);
1002 while (ConfigWord) {
1003 cprintf (
"%5d", ConfigWord & 1 ? temp : 0);
1005 ProtoConfigs[ConfigNum] += temp;
1015 cprintf (
"Proto Error for Configurations:\n");
1016 for (ConfigNum = 0; ConfigNum < ClassTemplate->
NumConfigs; ConfigNum++)
1019 ProtoConfigs[ConfigNum] /
1025 cprintf (
"Proto Sum for Configurations:\n");
1026 for (ConfigNum = 0; ConfigNum < ClassTemplate->
NumConfigs; ConfigNum++)
1027 cprintf (
" %4.1f", ProtoConfigs[ConfigNum] / 256.0);
1030 cprintf (
"Proto Length for Configurations:\n");
1031 for (ConfigNum = 0; ConfigNum < ClassTemplate->
NumConfigs; ConfigNum++)
1039 void IntegerMatcher::DisplayProtoDebugInfo(
1044 bool SeparateDebugWindows) {
1051 if (SeparateDebugWindows) {
1057 for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->
NumProtoSets;
1059 ProtoSet = ClassTemplate->
ProtoSets[ProtoSetIndex];
1063 (ActualProtoNum < ClassTemplate->NumProtos));
1064 ProtoNum++, ActualProtoNum++) {
1067 for (
int i = 0; i < ClassTemplate->
ProtoLengths[ActualProtoNum]; i++)
1072 if ((ProtoSet->
Protos[ProtoNum]).Configs[0] & (*ConfigMask)) {
1080 void IntegerMatcher::DisplayFeatureDebugInfo(
1086 int AdaptFeatureThreshold,
1088 bool SeparateDebugWindows) {
1091 tables->
Clear(ClassTemplate);
1094 if (SeparateDebugWindows) {
1099 for (
int Feature = 0; Feature < NumFeatures; Feature++) {
1100 UpdateTablesForFeature(
1101 ClassTemplate, ProtoMask, ConfigMask, Feature, &Features[Feature],
1106 for (
int i = 0; i < ClassTemplate->
NumConfigs; i++)
1112 if (best < AdaptFeatureThreshold)
1141 for (ProtoSetIndex = 0; ProtoSetIndex < ClassTemplate->
NumProtoSets;
1143 ProtoSet = ClassTemplate->
ProtoSets[ProtoSetIndex];
1147 ProtoNum++, ActualProtoNum++) {
1149 for (
int i = 0; i < ClassTemplate->
ProtoLengths[ActualProtoNum]; i++)
1153 ConfigWord &= *ConfigMask;
1155 while (ConfigWord) {
1157 *IntPointer += temp;
1172 for (
int i = 0; i < ClassTemplate->
NumConfigs; i++) {
1185 int IntegerMatcher::FindBestMatch(
1191 result->
fonts.truncate(0);
1195 for (
int c = 0; c < class_template->
NumConfigs; ++c) {
1197 if (*classify_debug_level_ > 2)
1198 tprintf(
"Config %d, rating=%d\n", c, rating);
1199 if (rating > best_match) {
1201 best_match = rating;
1207 result->
rating = best_match / 65536.0f;
1217 int normalization_factor,
1218 int matcher_multiplier) {
1219 return (rating * blob_length +
1220 matcher_multiplier * normalization_factor / 256.0) /
1221 (blob_length + matcher_multiplier);
1236 HeapSort (
int n,
register int ra[],
register int rb[]) {
1261 if (j < ir && ra[j] < ra[j + 1])
int FindGoodProtos(INT_CLASS ClassTemplate, BIT_VECTOR ProtoMask, BIT_VECTOR ConfigMask, uinT16 BlobLength, inT16 NumFeatures, INT_FEATURE_ARRAY Features, PROTO_ID *ProtoArray, int AdaptProtoThreshold, int Debug)
ClassPruner(int max_classes)
uinT8 feature_evidence_[MAX_NUM_CONFIGS]
void cprintf(const char *format,...)
void ComputeScores(const INT_TEMPLATES_STRUCT *int_templates, int num_features, const INT_FEATURE_STRUCT *features)
static const int kEvidenceTableBits
#define DisplayProtoMatchesOn(D)
void DisplayIntFeature(const INT_FEATURE_STRUCT *Feature, FLOAT32 Evidence)
#define offset_table_entries
void InitIntMatchWindowIfReqd()
void Init(tesseract::IntParam *classify_debug_level)
void DisableFragments(const UNICHARSET &unicharset)
#define CLASS_PRUNER_CLASS_MASK
void UpdateSumOfProtoEvidences(INT_CLASS ClassTemplate, BIT_VECTOR ConfigMask, inT16 NumFeatures)
#define next_table_entries
#define WERDS_PER_CP_VECTOR
INT_FEATURE_STRUCT INT_FEATURE_ARRAY[MAX_NUM_INT_FEATURES]
void HeapSort(int n, register int ra[], register int rb[])
void PruneAndSort(int pruning_factor, int keep_this, bool max_of_non_fragments, const UNICHARSET &unicharset)
void Match(INT_CLASS ClassTemplate, BIT_VECTOR ProtoMask, BIT_VECTOR ConfigMask, inT16 NumFeatures, const INT_FEATURE_STRUCT *Features, tesseract::UnicharRating *Result, int AdaptFeatureThreshold, int Debug, bool SeparateDebugWindows)
#define NUM_BITS_PER_CLASS
GenericVector< ScoredFont > fonts
int sum_feature_evidence_[MAX_NUM_CONFIGS]
T ClipToRange(const T &x, const T &lower_bound, const T &upper_bound)
void InitProtoDisplayWindowIfReqd()
#define PROTOS_PER_PROTO_SET
int RoundUp(int n, int block_size)
void Clear(const INT_CLASS class_template)
const char * string() const
static const float kSimilarityCenter
void AdjustForExpectedNumFeatures(const uinT16 *expected_num_features, int cutoff_strength)
static const int kIntEvidenceTruncBits
uinT8 proto_evidence_[MAX_NUM_PROTOS][MAX_PROTO_INDEX]
uinT32 Configs[WERDS_PER_CONFIG_VEC]
void DisableDisabledClasses(const UNICHARSET &unicharset)
float ApplyCNCorrection(float rating, int blob_length, int normalization_factor, int matcher_multiplier)
void InitFeatureDisplayWindowIfReqd()
INT_PROTO_STRUCT Protos[PROTOS_PER_PROTO_SET]
#define MatchDebuggingOn(D)
void DisplayIntProto(INT_CLASS Class, PROTO_ID ProtoId, FLOAT32 Evidence)
static const int kIntThetaFudge
void IMDebugConfigurationSum(int FeatureNum, uinT8 *FeatureEvidence, inT32 ConfigCount)
void ClearFeatureEvidence(const INT_CLASS class_template)
void NormalizeSums(INT_CLASS ClassTemplate, inT16 NumFeatures, inT32 used_features)
PROTO_SET ProtoSets[MAX_NUM_PROTO_SETS]
int PruneClasses(const INT_TEMPLATES_STRUCT *int_templates, int num_features, int keep_this, const INT_FEATURE_STRUCT *features, const uinT8 *normalization_factors, const uinT16 *expected_num_features, GenericVector< CP_RESULT_STRUCT > *results)
uinT32 p[NUM_CP_BUCKETS][NUM_CP_BUCKETS][NUM_CP_BUCKETS][WERDS_PER_CP_VECTOR]
ShapeTable * shape_table_
bool disable_character_fragments
int classify_class_pruner_multiplier
static const float kSEExponentialMultiplier
int FindBadFeatures(INT_CLASS ClassTemplate, BIT_VECTOR ProtoMask, BIT_VECTOR ConfigMask, uinT16 BlobLength, inT16 NumFeatures, INT_FEATURE_ARRAY Features, FEATURE_ID *FeatureArray, int AdaptFeatureThreshold, int Debug)
#define PrintProtoMatchesOn(D)
void IMDebugConfiguration(int FeatureNum, uinT16 ActualProtoNum, uinT8 Evidence, BIT_VECTOR ConfigMask, uinT32 ConfigWord)
int SetupResults(GenericVector< CP_RESULT_STRUCT > *results) const
#define ClipMatchEvidenceOn(D)
void SummarizeResult(const Classify &classify, const INT_TEMPLATES_STRUCT *int_templates, const uinT16 *expected_num_features, int norm_multiplier, const uinT8 *normalization_factors) const
void DebugMatch(const Classify &classify, const INT_TEMPLATES_STRUCT *int_templates, const INT_FEATURE_STRUCT *features) const
int classify_class_pruner_threshold
CLASS_PRUNER_STRUCT * ClassPruners[MAX_NUM_CLASS_PRUNERS]
#define DisplayFeatureMatchesOn(D)
#define PrintFeatureMatchesOn(D)
uinT16 ConfigLengths[MAX_NUM_CONFIGS]
bool get_enabled(UNICHAR_ID unichar_id) const
int classify_cp_cutoff_strength
void init_to_size(int size, T t)
const CHAR_FRAGMENT * get_fragment(UNICHAR_ID unichar_id) const
void NormalizeForXheight(int norm_multiplier, const uinT8 *normalization_factors)
#define INTMATCHER_OFFSET_TABLE_SIZE
#define PrintMatchSummaryOn(D)
STRING ClassIDToDebugStr(const INT_TEMPLATES_STRUCT *templates, int class_id, int config_id) const