Classifies the given [training] sample, writing to results. See ShapeClassifier for a full description.
| 29 | // Classifies the given [training] sample, writing to results. |
| 30 | // See ShapeClassifier for a full description. |
| 31 | int TessClassifier::UnicharClassifySample( |
| 32 | const TrainingSample& sample, Pix* page_pix, int debug, |
| 33 | UNICHAR_ID keep_this, GenericVector<UnicharRating>* results) { |
| 34 | int old_matcher_level = classify_->matcher_debug_level; |
| 35 | int old_matcher_flags = classify_->matcher_debug_flags; |
| 36 | int old_classify_level = classify_->classify_debug_level; |
| 37 | if (debug) { |
| 38 | // Explicitly set values of various control parameters to generate debug |
| 39 | // output if required, restoring the old values after classifying. |
| 40 | classify_->matcher_debug_level.set_value(2); |
| 41 | classify_->matcher_debug_flags.set_value(25); |
| 42 | classify_->classify_debug_level.set_value(3); |
| 43 | } |
| 44 | classify_->CharNormTrainingSample(pruner_only_, keep_this, sample, results); |
| 45 | if (debug) { |
| 46 | classify_->matcher_debug_level.set_value(old_matcher_level); |
| 47 | classify_->matcher_debug_flags.set_value(old_matcher_flags); |
| 48 | classify_->classify_debug_level.set_value(old_classify_level); |
| 49 | } |
| 50 | return results->size(); |
| 51 | } |
| 52 | |
| 53 | // Provides access to the ShapeTable that this classifier works with. |
| 54 | const ShapeTable* TessClassifier::GetShapeTable() const { |
no test coverage detected