From 47e101683ecd6cb2a8628e3643f0716b9b2927c6 Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Sat, 23 Mar 2024 22:09:40 +0000 Subject: [PATCH] Adjust FixCommonOcrLineErrors implementation in OcrFixEngine Changed input parameter to a local variable 'text' while calling FixOcrErrorViaLineReplaceList method in FixCommonOcrLineErrors. This improves the accuracy of OCR correction by ensuring the original text is not repeatedly used instead of the corrected version. --- src/ui/Logic/Ocr/OcrFixEngine.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/Logic/Ocr/OcrFixEngine.cs b/src/ui/Logic/Ocr/OcrFixEngine.cs index fec966af4..9e6ad614f 100644 --- a/src/ui/Logic/Ocr/OcrFixEngine.cs +++ b/src/ui/Logic/Ocr/OcrFixEngine.cs @@ -868,9 +868,9 @@ namespace Nikse.SubtitleEdit.Logic.Ocr private string FixCommonOcrLineErrors(string input, Subtitle subtitle, int index, string lastLine, string lastLastLine) { var text = input; - text = _ocrFixReplaceList.FixOcrErrorViaLineReplaceList(input, subtitle, index); + text = _ocrFixReplaceList.FixOcrErrorViaLineReplaceList(text, subtitle, index); text = FixOcrErrorsViaHardcodedRules(text, lastLine, lastLastLine, _abbreviationList); - text = _ocrFixReplaceList.FixOcrErrorViaLineReplaceList(input, subtitle, index); + text = _ocrFixReplaceList.FixOcrErrorViaLineReplaceList(text, subtitle, index); if (Configuration.Settings.Tools.OcrFixUseHardcodedRules) {