From b0fbcfae2ac5b906076463a35fb3bd3d254727d2 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 18 Dec 2021 19:06:43 +0100 Subject: [PATCH] Add name list to words-without-space-split Related to #5616 --- src/ui/Logic/Ocr/OcrFixEngine.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/Logic/Ocr/OcrFixEngine.cs b/src/ui/Logic/Ocr/OcrFixEngine.cs index 92feba374..4ddb4269a 100644 --- a/src/ui/Logic/Ocr/OcrFixEngine.cs +++ b/src/ui/Logic/Ocr/OcrFixEngine.cs @@ -302,7 +302,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr _nameListWithApostrophe = new HashSet(); var nameListWithPeriods = new List(); _abbreviationList = new HashSet(); - _wordSplitList = LoadWordSplitList(threeLetterIsoLanguageName); + _wordSplitList = LoadWordSplitList(threeLetterIsoLanguageName, _nameListObj); bool isEnglish = threeLetterIsoLanguageName.Equals("eng", StringComparison.OrdinalIgnoreCase); foreach (string name in _nameList) @@ -404,7 +404,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr } } - private string[] LoadWordSplitList(string threeLetterIsoLanguageName) + private string[] LoadWordSplitList(string threeLetterIsoLanguageName, NameList nameList) { var fileName = $"{Configuration.DictionariesDirectory}{threeLetterIsoLanguageName}_WordSplitList.txt"; if (!File.Exists(fileName)) @@ -412,8 +412,9 @@ namespace Nikse.SubtitleEdit.Logic.Ocr return Array.Empty(); } - var wordList = File.ReadAllText(fileName).SplitToLines().Where(p => p.Trim().Length > 0).ToArray(); - return wordList; + var wordList = File.ReadAllText(fileName).SplitToLines().Where(p => p.Trim().Length > 0).ToList(); + wordList.AddRange(nameList.GetNames().Where(p => p.Length > 4)); + return wordList.ToArray(); } public string SpellCheckDictionaryName