mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 04:33:04 +01:00
Improve OCR replace list guessses
This commit is contained in:
parent
a1c35e349e
commit
c78dda9571
@ -2820,7 +2820,7 @@
|
||||
</PartialWordsAlways>
|
||||
<PartialWords>
|
||||
<!-- Will be used to check words not in dictionary.
|
||||
If new word(s) and longer than 5 chars and exists in spelling dictionary, it is (or they are) accepted -->
|
||||
If new word(s) and longer than 4 chars and exists in spelling dictionary, it is (or they are) accepted -->
|
||||
<WordPart from="IVI" to="M" />
|
||||
<WordPart from="/" to="l" />
|
||||
<WordPart from="|" to="I" />
|
||||
|
@ -4,7 +4,7 @@
|
||||
<PartialWordsAlways />
|
||||
<PartialWords>
|
||||
<!-- Will be used to check words not in dictionary.
|
||||
If new word(s) and longer than 5 chars and exists
|
||||
If new word(s) and longer than 4 chars and exists
|
||||
in spelling dictionary, it is (or they are) accepted -->
|
||||
<!-- "f " will be two words -->
|
||||
<WordPart from="f" to="f " />
|
||||
|
@ -363,7 +363,7 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
if (word.Substring(i).StartsWith(letter, StringComparison.Ordinal))
|
||||
{
|
||||
|
||||
if (i == word.Length - letter.Length && !_partialWordReplaceList[letter].Contains(" "))
|
||||
if (i == word.Length - letter.Length && !_partialWordReplaceList[letter].Contains(' '))
|
||||
{
|
||||
var guess = word.Remove(i, letter.Length).Insert(i, _partialWordReplaceList[letter]);
|
||||
AddToGuessList(list, guess);
|
||||
@ -378,6 +378,8 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
}
|
||||
|
||||
if (indexes.Count > 1)
|
||||
{
|
||||
if (!_partialWordReplaceList[letter].Contains(' '))
|
||||
{
|
||||
var multiGuess = word;
|
||||
for (int i = indexes.Count - 1; i >= 0; i--)
|
||||
@ -386,6 +388,13 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
multiGuess = multiGuess.Remove(idx, letter.Length).Insert(idx, _partialWordReplaceList[letter]);
|
||||
AddToGuessList(list, multiGuess);
|
||||
}
|
||||
|
||||
AddToGuessList(list, word.Replace(letter, _partialWordReplaceList[letter]));
|
||||
}
|
||||
}
|
||||
else if (indexes.Count > 0)
|
||||
{
|
||||
AddToGuessList(list, word.Replace(letter, _partialWordReplaceList[letter]));
|
||||
}
|
||||
|
||||
if (indexes.Count > 0)
|
||||
|
@ -1592,7 +1592,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
|
||||
guesses.Add(wordWithVerticalLine);
|
||||
}
|
||||
|
||||
if (word.Length > 5 && autoGuess == AutoGuessLevel.Aggressive)
|
||||
if (word.Length > 4 && autoGuess == AutoGuessLevel.Aggressive)
|
||||
{
|
||||
guesses.AddRange((List<string>)_ocrFixReplaceList.CreateGuessesFromLetters(word));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user