From ebb625a2d430d94b8d351125035fd30e788fd4b7 Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Fri, 8 Nov 2024 01:48:56 +0000 Subject: [PATCH] Refactor: Consolidate word boundary characters Updated the OCR fix engine to use a single constant for word boundary characters. This simplifies the code and improves maintainability by avoiding repetition of the same character set in different places. Signed-off-by: Ivandro Jao --- src/ui/Logic/Ocr/OcrFixEngine.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/Logic/Ocr/OcrFixEngine.cs b/src/ui/Logic/Ocr/OcrFixEngine.cs index 89cd02ca94..baae5d0a20 100644 --- a/src/ui/Logic/Ocr/OcrFixEngine.cs +++ b/src/ui/Logic/Ocr/OcrFixEngine.cs @@ -523,9 +523,10 @@ public string FixOcrErrors(string input, Subtitle subtitle, int index, string pr sb = new StringBuilder(); var word = new StringBuilder(); string lastWord = null; + const string wordBoundaryChars = "\r\n "; for (var i = 0; i < text.Length; i++) { - if (text[i] != '.' && "\r\n ".Contains(text[i])) + if (wordBoundaryChars.Contains(text[i])) { if (word.Length > 0) {