Fix OCR replace list entry with "|" > "I"

+ a little clean
This commit is contained in:
niksedk 2021-11-05 21:08:21 +01:00
parent ee1a51eb8e
commit 44e9165666
2 changed files with 1 additions and 45 deletions

View File

@ -3371,7 +3371,7 @@
<RegEx find="^-_\.(\p{L})" replaceWith="- ...$1" />
<RegEx find="^_\.\.(\p{L})" replaceWith="...$1" />
<RegEx find=" l([!?\.])" replaceWith=" I$1" />
<RegEx find="\b\|\b" replaceWith="I" />
<RegEx find="(^| |&quot;)(\|)([ \.,!?])" replaceWith="$1I$3" />
<RegEx find="\b(1|l) (know|will|almost|didn't|get|got|have|apologize|paid|like|think|would|hope|shall|chose|choose|won|am|was|don't|just|start|run|saw|said|believe|try|ever|need|certainly|can't|anticipated|did|can|rang|heard|gave|came|decided|should|took|wanted|read|thought|was|still|do|love|want|overstepped|accept|authorized|owe|understand|made|guess|bumped|wasn't|mean|admire|had|spent|told|see|walk|were|help|definitely|could|say|take|brought|assume|proposed|realized|loved|base|left|change|changed|rule|feel|date|dated|imagine|went|kind|couldn't|wouldn't|work|care|make|lost|deserve|promise|swear|bring|put|found|wanna|swear|sold|save|figured|knew|kill|asked|supposed|act|wonder|leave|remind|stay|assure|guarantee|open|invited|doubt|refuse|sign|hid|might|wish)\b" replaceWith="I $2" />
<RegEx find=",\.\." replaceWith="..." />
<RegEx find="\bI KEA\b" replaceWith="IKEA" />

View File

@ -417,50 +417,6 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
}
}
internal static Dictionary<string, string> LoadReplaceList(XmlDocument doc, string name)
{
var list = new Dictionary<string, string>();
XmlNode node = doc.DocumentElement?.SelectSingleNode(name);
if (node != null)
{
foreach (XmlNode item in node.ChildNodes)
{
if (item.Attributes?["to"] != null && item.Attributes["from"] != null)
{
string to = item.Attributes["to"].InnerText;
string from = item.Attributes["from"].InnerText;
if (!list.ContainsKey(from))
{
list.Add(from, to);
}
}
}
}
return list;
}
internal static Dictionary<string, string> LoadRegExList(XmlDocument doc, string name)
{
var list = new Dictionary<string, string>();
XmlNode node = doc.DocumentElement?.SelectSingleNode(name);
if (node != null)
{
foreach (XmlNode item in node.ChildNodes)
{
if (item.Attributes?["replaceWith"] != null && item.Attributes["find"] != null)
{
string to = item.Attributes["replaceWith"].InnerText;
string from = item.Attributes["find"].InnerText;
if (!list.ContainsKey(from))
{
list.Add(from, to);
}
}
}
}
return list;
}
public string FixOcrErrors(string input, int index, string lastLine, bool logSuggestions, AutoGuessLevel autoGuess)
{
var text = input;