Trying to fix Greek "ν" in ocr - thx VK :)

This commit is contained in:
Nikolaj Olsson 2018-03-11 12:38:54 +01:00
parent 542d98dd6a
commit 461044541e
2 changed files with 11 additions and 5 deletions

View File

@ -3248,7 +3248,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
secondBestGuess = new CompareMatch(hit.Text, hit.Italic, hit.ExpandCount, hit.Key);
}
if (maxDiff > 0.1)
if (maxDiff > 1 && _isLatinDb)
{
if (bob.IsPeriod())
{
@ -3256,7 +3256,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
if (listIndex + 1 < list.Count)
next = list[listIndex + 1];
if (next == null || next.NikseBitmap == null)
if (next?.NikseBitmap == null)
return new CompareMatch(".", false, 0, null);
var nextBob = new BinaryOcrBitmap(next.NikseBitmap) { X = next.X, Y = next.Top };
@ -3269,7 +3269,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
if (listIndex + 1 < list.Count)
next = list[listIndex + 1];
if (next == null || next.NikseBitmap == null)
if (next?.NikseBitmap == null)
return new CompareMatch(",", false, 0, null);
var nextBob = new BinaryOcrBitmap(next.NikseBitmap) { X = next.X, Y = next.Top };
@ -5834,8 +5834,11 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
}
}
private bool _isLatinDb;
private void ButtonStartOcrClick(object sender, EventArgs e)
{
_isLatinDb = comboBoxCharacterDatabase.SelectedItem.ToString().Equals("Latin", StringComparison.Ordinal);
Configuration.Settings.VobSubOcr.RightToLeft = checkBoxRightToLeft.Checked;
_lastLine = null;
buttonOK.Enabled = false;
@ -6207,7 +6210,9 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
}
catch
{
// ignored
}
return result;
}

View File

@ -369,8 +369,9 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
case 'fl': // fb02
sb.Append("fl");
break;
case 'ν': // NOTE: Special unicode character!
sb.Append('v');
case 'ν': // NOTE: Special unicode character! (Greek character!)
if (_threeLetterIsoLanguageName != "ell" && _threeLetterIsoLanguageName != "gre")
sb.Append('v');
break;
case '': // #x201A (SINGLE LOW-9 QUOTATION MARK) to plain old comma
sb.Append(',');