我正在设置language_model_penalty_non_dict_word
通过 Tesseract 3.01 的配置文件,但其值没有任何效果。我尝试过使用多个图像及其多个值,但每个图像的输出始终相同。另一位用户也注意到了同样的情况在另一个问题的评论中 https://stackoverflow.com/questions/8940795/strength-of-dictionary-in-tesseract-3#comment19036313_8940795.
Edit:查看源代码后,变量language_model_penalty_non_dict_word
仅在函数内部使用float LanguageModel::ComputeAdjustedPathCost
.
然而,这个函数永远不会被调用!它仅被 2 个函数引用 -LanguageModel::UpdateBestChoice()
and LanguageModel::AddViterbiStateEntry()
。我在这些函数中放置了断点,但它们也没有被调用。
经过一番调试,终于找到了原因——函数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.3
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)