Change how names list works with split word list - thx Dnkhatri :)

This commit is contained in:
niksedk 2021-12-20 09:44:39 +01:00
parent 1b48c9bde1
commit 6e93a8248f
3 changed files with 2456 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B1BB9DD1-0EE8-4D43-AAAB-C39D0CC882A9}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
appveyor.yml = appveyor.yml
build.bat = build.bat
build_beta.bat = build_beta.bat
build_helpers.bat = build_helpers.bat

View File

@ -414,7 +414,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
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();
return wordList.OrderByDescending(p => p.Length).ToArray();
}
public string SpellCheckDictionaryName
@ -1921,7 +1921,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
{
foreach (string s in word.Split(' '))
{
if (!DoSpell(s))
if (!DoSpell(s) && !_nameList.Contains(s))
{
if (IsWordKnownOrNumber(word, word))
{
@ -1955,9 +1955,11 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
}
}
}
return false;
}
}
return true;
}