Improved "Fix common errors" a bit

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1019 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-03-05 16:56:36 +00:00
parent 71b267c786
commit 392fb7c680
3 changed files with 19 additions and 6 deletions

View File

@ -4,8 +4,9 @@ Subtitle Edit Changelog
* NEW: * NEW:
* Arabic language file - thx Zakaria Farah Abu Wael * Arabic language file - thx Zakaria Farah Abu Wael
* Export to VobSub format * Export to VobSub format
* Added new subtitle formats (now more than 80!) * Added new subtitle formats (now ~90!)
* Added export to FAB image script * Added export to FAB image script
* Added import of XSub from DivX files (use File -> Open)
* IMPROVED: * IMPROVED:
* Updated Basque languaged file - thx Xabier Aramendi * Updated Basque languaged file - thx Xabier Aramendi
* Export images alignment - thx Marcin * Export images alignment - thx Marcin

View File

@ -1215,7 +1215,7 @@ namespace Nikse.SubtitleEdit.Forms
arr[0] = arr[0].Insert(1, " "); arr[0] = arr[0].Insert(1, " ");
if (arr[0].Length > 6 && arr[0].StartsWith("<i>-") && arr[0][4] != ' ') if (arr[0].Length > 6 && arr[0].StartsWith("<i>-") && arr[0][4] != ' ')
arr[0] = arr[0].Insert(4, " "); arr[0] = arr[0].Insert(4, " ");
if (arr[1][0] == '-' && arr[1][1] != ' ') if (arr[1][0] == '-' && arr[1][1] != ' ' && arr[1][1] != '-')
arr[1] = arr[1].Insert(1, " "); arr[1] = arr[1].Insert(1, " ");
if (arr[1].Length > 6 && arr[1].StartsWith("<i>-") && arr[1][4] != ' ') if (arr[1].Length > 6 && arr[1].StartsWith("<i>-") && arr[1][4] != ' ')
arr[1] = arr[1].Insert(4, " "); arr[1] = arr[1].Insert(4, " ");
@ -1484,7 +1484,12 @@ namespace Nikse.SubtitleEdit.Forms
{ {
int index = text.IndexOf("\""); int index = text.IndexOf("\"");
if (text[index - 1] == ' ') if (text[index - 1] == ' ')
p.Text = p.Text.Trim() + "\""; {
if (p.Text.EndsWith(","))
p.Text = p.Text.Insert(p.Text.Length - 1, "\"").Trim();
else
p.Text = p.Text.Trim() + "\"";
}
else if (text[index + 1] == ' ') else if (text[index + 1] == ' ')
p.Text = "\"" + p.Text; p.Text = "\"" + p.Text;
} }
@ -2297,6 +2302,9 @@ namespace Nikse.SubtitleEdit.Forms
if (prev == "-" && match.Index > 2) if (prev == "-" && match.Index > 2)
fix = false; fix = false;
if (fix && next == "-" && match.Index < s.Length - 5 && s[match.Index + 2] == 'l' && !(Environment.NewLine + " <>!.?:;,").Contains(s[match.Index + 3].ToString()))
fix = false;
if (fix) if (fix)
{ {
string temp = s.Substring(0, match.Index) + "I"; string temp = s.Substring(0, match.Index) + "I";
@ -2384,7 +2392,7 @@ namespace Nikse.SubtitleEdit.Forms
idx = text.IndexOf("-", idxNL); idx = text.IndexOf("-", idxNL);
if (idx >=0 && idxNL + 5 > idxNL) if (idx >=0 && idxNL + 5 > idxNL)
{ {
text = text.Remove(idx, 1).TrimStart(); text = text.Remove(idx, 1).TrimStart().Replace(Environment.NewLine + " ", Environment.NewLine);
idx = text.IndexOf("-", idxNL); idx = text.IndexOf("-", idxNL);
if (idx >= 0 && idxNL + 5 > idxNL) if (idx >= 0 && idxNL + 5 > idxNL)
@ -2392,7 +2400,7 @@ namespace Nikse.SubtitleEdit.Forms
text = text.Remove(idx, 1).TrimStart(); text = text.Remove(idx, 1).TrimStart();
text = text.Replace(" ", " "); text = text.Replace(" ", " ");
text = text.Remove(idx, 1).Replace(Environment.NewLine + " ", Environment.NewLine); text = text.Replace(Environment.NewLine + " ", Environment.NewLine);
text = text.Replace("> ", ">"); text = text.Replace("> ", ">");
text = text.Replace(" <", "<"); text = text.Replace(" <", "<");
} }

View File

@ -900,6 +900,10 @@ namespace Nikse.SubtitleEdit.Logic.OCR
if (line.EndsWith(" " + abbreviation.ToLower())) if (line.EndsWith(" " + abbreviation.ToLower()))
return true; return true;
} }
if (line.Length > 5 && line[line.Length - 3] == '.' && Utilities.GetLetters(true, true, false).Contains(line[line.Length - 2].ToString()))
return true;
return false; return false;
} }
@ -1216,7 +1220,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
} }
} }
string[] words = tempLine.Split((Environment.NewLine + " ¡¿,.!?:;()[]{}+-£\"”“#&%…—♪").ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string[] words = tempLine.Split((Environment.NewLine + " ¡¿,.!?:;()[]{}+-£\"”“#&%…—♪/").ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < words.Length; i++) for (int i = 0; i < words.Length; i++)
{ {
string word = words[i].TrimStart('\''); string word = words[i].TrimStart('\'');