Add language context menu to edit bic db + update OCR dictionaries

This commit is contained in:
Nikolaj Olsson 2020-05-18 15:03:26 +02:00
parent 6db1414c2d
commit 001e361d7c
5 changed files with 1107 additions and 3 deletions

View File

@ -1320,7 +1320,6 @@
<Word from="let'sjust" to="let's just" />
<Word from="Let'sjust" to="Let's just" />
<Word from="Lf" to="If" />
<Word from="lf" to="if" />
<Word from="lfeelonelung" to="I feel one lung" />
<Word from="lfhe's" to="If he's" />
<Word from="lfl" to="if I" />
@ -1401,7 +1400,6 @@
<Word from="lsolation" to="Isolation" />
<Word from="Lst's" to="Let's" />
<Word from="lsuppose" to="I suppose" />
<Word from="lt" to="it" />
<Word from="Lt" to="It" />
<Word from="ltake" to="I take" />
<Word from="ltalian" to="Italian" />
@ -2845,6 +2843,11 @@
<PartialLinesAlways>
<LinePart from="forbest act" to="for best act" />
<LinePart from=",.," to="..." />
<LinePart from=" lt " to=" it " />
<LinePart from=". lt " to=". It " />
<LinePart from=" lf " to=" if " />
<LinePart from=". lf " to=". If " />
<LinePart from=" . " to=". " />
</PartialLinesAlways>
<PartialLines>
<LinePart from=" /be " to=" I be " />
@ -3311,6 +3314,9 @@
<Beginning from="H m, " to="Hm, " />
<Beginning from="Im sorry" to="I'm sorry" />
<Beginning from="lce " to="Ice " />
<Beginning from="lf " to="If " />
<Beginning from="-lf " to="-If " />
<Beginning from="-lt " to="-It " />
</BeginLines>
<EndLines>
<Ending from=", sin" to=", sir." />
@ -3322,6 +3328,8 @@
<Ending from=" i..." to=" I..." />
<Ending from=" L." to=" I." />
<Ending from=" ." to="." />
<Ending from=" !" to="!" />
<Ending from=" lf " to=" if " />
</EndLines>
<RegularExpressions>
<RegEx find="([a-z]) Won't " replaceWith="$1 won't " />
@ -3332,8 +3340,13 @@
<RegEx find="^_\.\.(\p{L})" replaceWith="...$1" />
<RegEx find=" l([!?\.])" replaceWith=" I$1" />
<RegEx find="\b\|\b" replaceWith="I" />
<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)\b" replaceWith="I $2" />
<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" />
<RegEx find="\b(A|a)m (l|1)\b" replaceWith="$1m I" />
<RegEx find="\b1 00K\b" replaceWith="100K" />
<RegEx find="\bl\b" replaceWith="I" />
<RegEx find="\. lt\b" replaceWith=". It" />
<RegEx find="\. lf\b" replaceWith=". If" />
</RegularExpressions>
</OCRFixReplaceList>

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -74,6 +74,21 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
UiUtil.FixLargeFonts(this, buttonOK);
buttonImport.Visible = binOcrDb != null;
foreach (ToolStripItem toolStripItem in contextMenuStripLetters.Items)
{
if (toolStripItem is ToolStripDropDownItem i && i.HasDropDownItems)
{
foreach (ToolStripItem item in i.DropDownItems)
{
item.Click += InsertLanguageCharacter;
}
}
else
{
toolStripItem.Click += InsertLanguageCharacter;
}
}
}
private void Refill(List<VobSubOcr.ImageCompareAddition> additions)
@ -706,5 +721,16 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
}
}
private void InsertLanguageCharacter(object sender, EventArgs e)
{
if (sender is ToolStripMenuItem toolStripMenuItem)
{
var start = textBoxText.SelectionStart;
textBoxText.SelectedText = toolStripMenuItem.Text;
textBoxText.SelectionLength = 0;
textBoxText.SelectionStart = start + toolStripMenuItem.Text.Length;
}
}
}
}

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStripLetters.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>308, 17</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>