mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Minor ocr fixes
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@757 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
1934523544
commit
8a66df5955
@ -2072,7 +2072,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
textWithOutFixes = Tesseract3DoOcrViaExe(bitmap, _languageId, "-psm 6"); // 6 = Assume a single uniform block of text.
|
||||
}
|
||||
|
||||
if (!textWithOutFixes.Contains(Environment.NewLine) && textWithOutFixes.Length < 12)
|
||||
if (!textWithOutFixes.Contains(Environment.NewLine) && textWithOutFixes.Length < 17)
|
||||
{
|
||||
string psm = Tesseract3DoOcrViaExe(bitmap, _languageId, "-psm 7"); // 7 = Treat the image as a single text line.
|
||||
if (psm.Length > textWithOutFixes.Length)
|
||||
@ -2104,15 +2104,24 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (wordsNotFound > 0 || correctWords == 0)
|
||||
{
|
||||
List<string> oldUnkownWords = new List<string>();
|
||||
oldUnkownWords.AddRange(_ocrFixEngine.UnknownWordsFound);
|
||||
_ocrFixEngine.UnknownWordsFound.Clear();
|
||||
|
||||
string newUnfixedText = TesseractResizeAndRetry(bitmap);
|
||||
string newText = _ocrFixEngine.FixOcrErrors(newUnfixedText, index, _lastLine, true, checkBoxGuessUnknownWords.Checked);
|
||||
int newWordsNotFound = _ocrFixEngine.CountUnknownWordsViaDictionary(newText, out correctWords);
|
||||
if (newWordsNotFound < wordsNotFound)
|
||||
if (newWordsNotFound < wordsNotFound || (newWordsNotFound == wordsNotFound && newText.EndsWith("!") && textWithOutFixes.EndsWith("l")))
|
||||
{
|
||||
wordsNotFound = newWordsNotFound;
|
||||
textWithOutFixes = newUnfixedText;
|
||||
line = newText;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ocrFixEngine.UnknownWordsFound.Clear();
|
||||
_ocrFixEngine.UnknownWordsFound.AddRange(oldUnkownWords);
|
||||
}
|
||||
}
|
||||
|
||||
if (wordsNotFound > 0 || correctWords == 0 || textWithOutFixes != null && textWithOutFixes.ToString().Replace("~", string.Empty).Trim().Length == 0)
|
||||
|
@ -1202,6 +1202,9 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
break;
|
||||
case OcrSpellCheck.Action.SkipAll:
|
||||
_wordSkipList.Add(_spellCheck.Word);
|
||||
_wordSkipList.Add(_spellCheck.Word.ToUpper());
|
||||
if (_spellCheck.Word.Length > 1)
|
||||
_wordSkipList.Add(_spellCheck.Word.Substring(0,1).ToUpper() + _spellCheck.Word.Substring(1));
|
||||
break;
|
||||
case OcrSpellCheck.Action.SkipOnce:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user