mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 06:52:35 +01:00
Minor fix in "Fix common ocr errors" for italic lines starting with "Io " - thx matidio :)
This commit is contained in:
parent
93feb8a4f9
commit
f1438f286a
@ -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);
|
||||
|
@ -1116,7 +1116,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
||||
return false;
|
||||
}
|
||||
|
||||
public static string FixOcrErrorsViaHardcodedRules(string input, string lastLine, HashSet<string> abbreviationList)
|
||||
public string FixOcrErrorsViaHardcodedRules(string input, string lastLine, HashSet<string> 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user