diff --git a/src/Forms/VobSubOcr.cs b/src/Forms/VobSubOcr.cs index d3ed41db6..bce3e726d 100644 --- a/src/Forms/VobSubOcr.cs +++ b/src/Forms/VobSubOcr.cs @@ -3903,8 +3903,8 @@ namespace Nikse.SubtitleEdit.Forms { line = threadText; } - if (checkBoxAutoFixCommonErrors.Checked) - line = OcrFixEngine.FixOcrErrorsViaHardcodedRules(line, _lastLine, null); // TODO: add abbreviations list + if (checkBoxAutoFixCommonErrors.Checked && _ocrFixEngine != null) + line = _ocrFixEngine.FixOcrErrorsViaHardcodedRules(line, _lastLine, null); // TODO: add abbreviations list if (checkBoxRightToLeft.Checked) line = ReverseNumberStrings(line); @@ -4109,8 +4109,8 @@ namespace Nikse.SubtitleEdit.Forms { line = threadText; } - if (checkBoxAutoFixCommonErrors.Checked) - line = OcrFixEngine.FixOcrErrorsViaHardcodedRules(line, _lastLine, null); // TODO: add abbreviations list + if (checkBoxAutoFixCommonErrors.Checked && _ocrFixEngine != null) + line = _ocrFixEngine.FixOcrErrorsViaHardcodedRules(line, _lastLine, null); // TODO: add abbreviations list if (checkBoxRightToLeft.Checked) line = ReverseNumberStrings(line); @@ -4606,8 +4606,8 @@ namespace Nikse.SubtitleEdit.Forms line = line.Replace("9-O", "9-0"); } - if (checkBoxAutoFixCommonErrors.Checked) - line = OcrFixEngine.FixOcrErrorsViaHardcodedRules(line, _lastLine, null); // TODO: add abbreviations list + if (checkBoxAutoFixCommonErrors.Checked && _ocrFixEngine != null) + line = _ocrFixEngine.FixOcrErrorsViaHardcodedRules(line, _lastLine, null); // TODO: add abbreviations list if (checkBoxRightToLeft.Checked) line = ReverseNumberStrings(line); diff --git a/src/Logic/OCR/OcrFixEngine.cs b/src/Logic/OCR/OcrFixEngine.cs index 2719449f0..352397a6d 100644 --- a/src/Logic/OCR/OcrFixEngine.cs +++ b/src/Logic/OCR/OcrFixEngine.cs @@ -1116,7 +1116,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR return false; } - public static string FixOcrErrorsViaHardcodedRules(string input, string lastLine, HashSet abbreviationList) + public string FixOcrErrorsViaHardcodedRules(string input, string lastLine, HashSet abbreviationList) { if (!Configuration.Settings.Tools.OcrFixUseHardcodedRules) return input; @@ -1227,7 +1227,6 @@ namespace Nikse.SubtitleEdit.Logic.OCR input = input.Insert(idx + Environment.NewLine.Length + 4, " "); } - if (string.IsNullOrEmpty(lastLine) || lastLine.EndsWith(".") || lastLine.EndsWith("!") || @@ -1244,6 +1243,8 @@ namespace Nikse.SubtitleEdit.Logic.OCR string uppercaseLetter = st.StrippedText[0].ToString().ToUpper(); if (st.StrippedText.Length > 1 && uppercaseLetter == "L" && "abcdfghjklmnpqrstvwxz".Contains(st.StrippedText[1].ToString())) uppercaseLetter = "I"; + if (st.StrippedText.StartsWith("lo ") && _threeLetterIsoLanguageName == "ita") + uppercaseLetter = "I"; st.StrippedText = st.StrippedText.Remove(0, 1).Insert(0, uppercaseLetter); input = st.Pre + st.StrippedText + st.Post; }