mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-28 05:33:59 +08:00
Fix FP division by zero in LanguageModel::ExtractFeaturesFromPath (issue #3995)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
1852afe9f8
commit
3bedea1bdd
@ -1375,7 +1375,12 @@ void LanguageModel::ExtractFeaturesFromPath(const ViterbiStateEntry &vse, float
|
||||
// features[PTRAIN_NUM_BAD_FONT] = vse.consistency_info.inconsistent_font;
|
||||
|
||||
// Classifier-related features.
|
||||
if (vse.outline_length > 0.0f) {
|
||||
features[PTRAIN_RATING_PER_CHAR] = vse.ratings_sum / vse.outline_length;
|
||||
} else {
|
||||
// Avoid FP division by 0.
|
||||
features[PTRAIN_RATING_PER_CHAR] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
WERD_CHOICE *LanguageModel::ConstructWord(ViterbiStateEntry *vse, WERD_RES *word_res,
|
||||
|
Loading…
Reference in New Issue
Block a user