Improve fix ocr for large lines

This commit is contained in:
Nikolaj Olsson 2020-09-29 20:57:11 +02:00
parent d83925031d
commit 655c16a100
2 changed files with 2 additions and 2 deletions

View File

@ -1113,7 +1113,7 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
int appendFrom = 0;
for (int i = 0; i < text.Length; i++)
{
if (text.Substring(i).StartsWith(word, StringComparison.Ordinal) && i >= appendFrom)
if (text[i] == word[0] && i >= appendFrom && text.Substring(i).StartsWith(word, StringComparison.Ordinal))
{
bool startOk = i == 0;
if (!startOk)

View File

@ -1403,7 +1403,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
words.Add(w.Trim(trimChars));
}
for (int i = 0; i < words.Count; i++)
for (int i = 0; i < words.Count && i < 1000; i++)
{
string word = words[i].TrimStart('\'');
string wordNotEndTrimmed = word;