mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
OCR fix regarding Tesseract - thx jpsdr :)
This commit is contained in:
parent
49716f16cf
commit
5af5982b6b
@ -5830,8 +5830,20 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
!psm.Contains('Y') && textWithOutFixes.Contains('Y') ||
|
||||
!psm.Contains('\'') && textWithOutFixes.Contains('\'') ||
|
||||
!psm.Contains('€') && textWithOutFixes.Contains('€'))
|
||||
|
||||
{
|
||||
textWithOutFixes = psm;
|
||||
}
|
||||
else if (_ocrFixEngine != null && !psm.Contains('$') && !psm.Contains('•') && !psm.Contains('€'))
|
||||
{
|
||||
int correctWordsNoFixes;
|
||||
int wordsNotFoundNoFixes = _ocrFixEngine.CountUnknownWordsViaDictionary(textWithOutFixes, out correctWordsNoFixes);
|
||||
int correctWordsPsm7;
|
||||
int wordsNotFoundPsm7 = _ocrFixEngine.CountUnknownWordsViaDictionary(psm, out correctWordsPsm7);
|
||||
if (wordsNotFoundPsm7 <= wordsNotFoundNoFixes && correctWordsPsm7 > correctWordsNoFixes)
|
||||
{
|
||||
textWithOutFixes = psm;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (psm.Length == textWithOutFixes.Length &&
|
||||
(!psm.Contains('0') && textWithOutFixes.Contains('0') || // these chars are often mistaken
|
||||
|
Loading…
Reference in New Issue
Block a user