From a0914fa0b39af1538cc7cb69be387f80eac15ba8 Mon Sep 17 00:00:00 2001 From: niksedk Date: Tue, 18 Jan 2011 06:36:30 +0000 Subject: [PATCH] Issue 7: Spell check should ignore ellipsis character as punctuation git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@262 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Forms/RemoveTextFromHearImpaired.cs | 8 ++++---- src/Forms/SpellCheck.cs | 2 +- src/Logic/OCR/OcrFixEngine.cs | 4 ++-- src/Logic/StripableText.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Forms/RemoveTextFromHearImpaired.cs b/src/Forms/RemoveTextFromHearImpaired.cs index 1ca27eabe..ee3dc0acd 100644 --- a/src/Forms/RemoveTextFromHearImpaired.cs +++ b/src/Forms/RemoveTextFromHearImpaired.cs @@ -340,14 +340,14 @@ namespace Nikse.SubtitleEdit.Forms string oldText = text; text = RemoveColon(text); - StripableText st = new StripableText(text, " >-\"'‘`´♪¿¡.", " -\"'`´♪.!?:"); + StripableText st = new StripableText(text, " >-\"'‘`´♪¿¡.…—", " -\"'`´♪.!?:…—"); var sb = new StringBuilder(); string[] parts = st.StrippedText.Trim().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); int lineNumber = 0; bool removedDialogInFirstLine = false; foreach (string s in parts) - { - StripableText stSub = new StripableText(s, " >-\"'‘`´♪¿¡.", " -\"'`´♪.!?:"); + { + StripableText stSub = new StripableText(s, " >-\"'‘`´♪¿¡.…—", " -\"'`´♪.!?:…—"); if (!StartAndEndsWithHearImpariedTags(stSub.StrippedText)) { if (removedDialogInFirstLine && stSub.Pre.Contains("- ")) @@ -378,7 +378,7 @@ namespace Nikse.SubtitleEdit.Forms text = st.Pre + sb.ToString().Trim() + st.Post; text = RemoveColon(text); - st = new StripableText(text, " >-\"'‘`´♪¿¡.", " -\"'`´♪.!?:"); + st = new StripableText(text, " >-\"'‘`´♪¿¡.…—", " -\"'`´♪.!?:…—"); text = st.StrippedText; if (StartAndEndsWithHearImpariedTags(text)) { diff --git a/src/Forms/SpellCheck.cs b/src/Forms/SpellCheck.cs index 23a023ea8..5e9e11f7e 100644 --- a/src/Forms/SpellCheck.cs +++ b/src/Forms/SpellCheck.cs @@ -420,7 +420,7 @@ namespace Nikse.SubtitleEdit.Forms _currentIndex++; _currentParagraph = _subtitle.Paragraphs[_currentIndex]; string s = Utilities.RemoveHtmlTags(_currentParagraph.Text); - _words = s.Split(" .,-?!:;\"“”()[]{}|<>/+\r\n¿¡".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + _words = s.Split(" .,-?!:;\"“”()[]{}|<>/+\r\n¿¡…—".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); _wordsIndex = 0; if (_words.Length == 0) { diff --git a/src/Logic/OCR/OcrFixEngine.cs b/src/Logic/OCR/OcrFixEngine.cs index 45f6eb563..462ca5da0 100644 --- a/src/Logic/OCR/OcrFixEngine.cs +++ b/src/Logic/OCR/OcrFixEngine.cs @@ -667,7 +667,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR if (_hunspell == null) return line; - string[] words = line.Split((Environment.NewLine + " ,.!?:;()[]{}+-$£\"”“#&%").ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + string[] words = line.Split((Environment.NewLine + " ,.!?:;()[]{}+-$£\"”“#&%…—").ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < words.Length; i++) { string word = words[i]; @@ -1007,7 +1007,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR return 0; int wordsNotFound = 0; - string[] words = line.Split((Environment.NewLine + " ,.!?:;()[]{}+-$£\"#&%").ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + string[] words = line.Split((Environment.NewLine + " ,.!?:;()[]{}+-$£\"#&%…“”").ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < words.Length; i++) { string word = words[i]; diff --git a/src/Logic/StripableText.cs b/src/Logic/StripableText.cs index c3948093b..70486d855 100644 --- a/src/Logic/StripableText.cs +++ b/src/Logic/StripableText.cs @@ -20,7 +20,7 @@ namespace Nikse.SubtitleEdit.Logic } public StripableText(string text) - : this(text, " >-\"”“['‘`´¶(♪¿¡.", " -\"”“]'`´¶)♪.!?:") + : this(text, " >-\"”“['‘`´¶(♪¿¡.…—", " -\"”“]'`´¶)♪.!?:…—") { }