Merge pull request #3467 from ivandrofly/ocrfixengine

OcrFixEngine: minor optimization
This commit is contained in:
Nikolaj Olsson 2019-03-15 13:22:33 +01:00 committed by GitHub
commit 11a926f717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1350,21 +1350,8 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
if (!correct && word.Contains('/') && !word.Contains("//"))
{
var slashedWords = word.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
bool allSlashedCorrect = true;
foreach (var slashedWord in slashedWords)
{
if (slashedWord.Length < 2)
{
allSlashedCorrect = false;
}
if (allSlashedCorrect && !(DoSpell(slashedWord) || IsWordKnownOrNumber(slashedWord, line)))
{
allSlashedCorrect = false;
}
}
correct = allSlashedCorrect;
correct = word.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)
.All(w => w.Length > 2 && (DoSpell(w) || IsWordKnownOrNumber(word, line)));
}
if (word.Length == 0)