我正在通过Tesseract 3.01的配置文件设置language_model_penalty_non_dict_word,但是它的值没有任何效果。我尝试过多个图像,以及多个值,但是每个图像的输出总是相同的。另一个用户注意到了同一个in a comment in another question。
编辑:在查看源代码之后,变量language_model_penalty_non_dict_word仅在函数float LanguageModel::ComputeAdjustedPathCost中使用。
但是,这个函数永远不会被调用!它仅由两个函数- LanguageModel::UpdateBestChoice()和LanguageModel::AddViterbiStateEntry()引用。我在这些函数中放置了断点,但它们也没有被调用。
发布于 2015-04-24 09:14:31
经过一些调试,我终于找到了原因--函数Wordrec::SegSearch()没有被调用(它在LanguageModel::ComputeAdjustedPathCost()的调用图中)。
从这个代码中:
if (enable_new_segsearch) {
SegSearch(&chunks_record, word->best_choice,
best_char_choices, word->raw_choice, state);
} else {
best_first_search(&chunks_record, best_char_choices, word,
state, fixpt, best_state);
}因此,您需要在配置文件中设置enable_new_segsearch:
enable_new_segsearch 1
language_model_penalty_non_freq_dict_word 0.2
language_model_penalty_non_dict_word 0.3https://stackoverflow.com/questions/29826591
复制相似问题