MCPcopy Create free account
hub / github.com/creatale/node-dv / ReadNewCutoffs

Method ReadNewCutoffs

deps/tesseract/classify/cutoffs.cpp:52–78  ·  view source on GitHub ↗

* Open Filename, read in all of the class-id/cutoff pairs * and insert them into the Cutoffs array. Cutoffs are * indexed in the array by class id. Unused entries in the * array are set to an arbitrarily high cutoff value. * @param CutoffFile name of file containing cutoff definitions * @param Cutoffs array to put cutoffs into * @param swap * @param end_offset * @return none * @note Glo

Source from the content-addressed store, hash-verified

50 * @note History: Wed Feb 20 09:38:26 1991, DSJ, Created.
51 */
52void Classify::ReadNewCutoffs(FILE *CutoffFile, bool swap, inT64 end_offset,
53 CLASS_CUTOFF_ARRAY Cutoffs) {
54 char Class[UNICHAR_LEN + 1];
55 CLASS_ID ClassId;
56 int Cutoff;
57 int i;
58
59 if (shape_table_ != NULL) {
60 if (!shapetable_cutoffs_.DeSerialize(swap, CutoffFile)) {
61 tprintf("Error during read of shapetable pffmtable!\n");
62 }
63 }
64 for (i = 0; i < MAX_NUM_CLASSES; i++)
65 Cutoffs[i] = MAX_CUTOFF;
66
67 while ((end_offset < 0 || ftell(CutoffFile) < end_offset) &&
68 tfscanf(CutoffFile, "%" REALLY_QUOTE_IT(UNICHAR_LEN) "s %d",
69 Class, &Cutoff) == 2) {
70 if (strcmp(Class, "NULL") == 0) {
71 ClassId = unicharset.unichar_to_id(" ");
72 } else {
73 ClassId = unicharset.unichar_to_id(Class);
74 }
75 Cutoffs[ClassId] = Cutoff;
76 SkipNewline(CutoffFile);
77 }
78}
79
80} // namespace tesseract

Callers

nothing calls this directly

Calls 4

tfscanfFunction · 0.85
SkipNewlineFunction · 0.85
DeSerializeMethod · 0.45
unichar_to_idMethod · 0.45

Tested by

no test coverage detected