sas*_*alm 5 ocr command-line tesseract
我正在设置language_model_penalty_non_dict_wordTesseract 3.01的配置文件,但它的值没有任何影响.我尝试过多个图像,并且有多个值,但每个图像的输出总是相同的.另一个用户在另一个问题的评论中注意到了相同的内容.
编辑:查看源内部后,该变量language_model_penalty_non_dict_word仅在函数内部使用float LanguageModel::ComputeAdjustedPathCost.
但是,这个功能永远不会被调用!它仅由2个函数引用 - LanguageModel::UpdateBestChoice()和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