mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
spell check will now accept names with ending with "'s" automatically (English languages only)
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@252 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
c5e216b396
commit
15970a7274
@ -28,6 +28,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
List<string> _namesEtcList = new List<string>();
|
List<string> _namesEtcList = new List<string>();
|
||||||
List<string> _namesEtcMultiWordList = new List<string>();
|
List<string> _namesEtcMultiWordList = new List<string>();
|
||||||
List<string> _namesEtcListUppercase = new List<string>();
|
List<string> _namesEtcListUppercase = new List<string>();
|
||||||
|
List<string> _namesEtcListWithApostrophe = new List<string>();
|
||||||
List<string> _skipAllList = new List<string>();
|
List<string> _skipAllList = new List<string>();
|
||||||
Dictionary<string, string> _changeAllDictionary = new Dictionary<string, string>();
|
Dictionary<string, string> _changeAllDictionary = new Dictionary<string, string>();
|
||||||
List<string> _userWordList = new List<string>();
|
List<string> _userWordList = new List<string>();
|
||||||
@ -371,6 +372,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
_namesEtcList.Add(_currentWord);
|
_namesEtcList.Add(_currentWord);
|
||||||
_namesEtcListUppercase.Add(_currentWord.ToUpper());
|
_namesEtcListUppercase.Add(_currentWord.ToUpper());
|
||||||
|
if (!_currentWord.EndsWith("s"))
|
||||||
|
_namesEtcListWithApostrophe.Add(_currentWord + "'s");
|
||||||
|
else
|
||||||
|
_namesEtcListWithApostrophe.Add(_currentWord + "'");
|
||||||
Utilities.AddWordToLocalNamesEtcList(_currentWord, _languageName);
|
Utilities.AddWordToLocalNamesEtcList(_currentWord, _languageName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -378,6 +383,8 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
if (!_namesEtcList.Contains(ChangeWord))
|
if (!_namesEtcList.Contains(ChangeWord))
|
||||||
Utilities.AddWordToLocalNamesEtcList(ChangeWord, _languageName);
|
Utilities.AddWordToLocalNamesEtcList(ChangeWord, _languageName);
|
||||||
_namesEtcListUppercase.Add(ChangeWord.ToUpper());
|
_namesEtcListUppercase.Add(ChangeWord.ToUpper());
|
||||||
|
_namesEtcListUppercase.Add(_currentWord.ToUpper());
|
||||||
|
if (!_currentWord.EndsWith("s"))
|
||||||
_noOfChangedWords++;
|
_noOfChangedWords++;
|
||||||
if (!_changeAllDictionary.ContainsKey(_currentWord))
|
if (!_changeAllDictionary.ContainsKey(_currentWord))
|
||||||
_changeAllDictionary.Add(_currentWord, ChangeWord);
|
_changeAllDictionary.Add(_currentWord, ChangeWord);
|
||||||
@ -508,6 +515,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
_noOfNamesEtc++;
|
_noOfNamesEtc++;
|
||||||
}
|
}
|
||||||
|
else if (_namesEtcListWithApostrophe.IndexOf(_currentWord) >= 0)
|
||||||
|
{
|
||||||
|
_noOfNamesEtc++;
|
||||||
|
}
|
||||||
else if (Utilities.IsInNamesEtcMultiWordList(_namesEtcMultiWordList, _currentParagraph.Text, _currentWord)) //TODO: verify this!
|
else if (Utilities.IsInNamesEtcMultiWordList(_namesEtcMultiWordList, _currentParagraph.Text, _currentWord)) //TODO: verify this!
|
||||||
{
|
{
|
||||||
_noOfNamesEtc++;
|
_noOfNamesEtc++;
|
||||||
@ -597,6 +608,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
_namesEtcList = new List<string>();
|
_namesEtcList = new List<string>();
|
||||||
_namesEtcMultiWordList = new List<string>();
|
_namesEtcMultiWordList = new List<string>();
|
||||||
_namesEtcListUppercase = new List<string>();
|
_namesEtcListUppercase = new List<string>();
|
||||||
|
_namesEtcListWithApostrophe = new List<string>();
|
||||||
|
|
||||||
_skipAllList = new List<string>();
|
_skipAllList = new List<string>();
|
||||||
|
|
||||||
@ -636,6 +648,17 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
foreach (string namesItem in _namesEtcList)
|
foreach (string namesItem in _namesEtcList)
|
||||||
_namesEtcListUppercase.Add(namesItem.ToUpper());
|
_namesEtcListUppercase.Add(namesItem.ToUpper());
|
||||||
|
|
||||||
|
if (_languageName.ToLower().StartsWith("en_"))
|
||||||
|
{
|
||||||
|
foreach (string namesItem in _namesEtcList)
|
||||||
|
{
|
||||||
|
if (!namesItem.EndsWith("s"))
|
||||||
|
_namesEtcListWithApostrophe.Add(namesItem + "'s");
|
||||||
|
else
|
||||||
|
_namesEtcListWithApostrophe.Add(namesItem + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_userWordList = new List<string>();
|
_userWordList = new List<string>();
|
||||||
_userWordDictionary = new XmlDocument();
|
_userWordDictionary = new XmlDocument();
|
||||||
if (File.Exists(dictionaryFolder + _languageName + "_user.xml"))
|
if (File.Exists(dictionaryFolder + _languageName + "_user.xml"))
|
||||||
|
@ -26,6 +26,7 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
|||||||
string _fiveLetterWordListLanguageName;
|
string _fiveLetterWordListLanguageName;
|
||||||
List<string> _namesEtcList = new List<string>();
|
List<string> _namesEtcList = new List<string>();
|
||||||
List<string> _namesEtcListUppercase = new List<string>();
|
List<string> _namesEtcListUppercase = new List<string>();
|
||||||
|
List<string> _namesEtcListWithApostrophe = new List<string>();
|
||||||
List<string> _namesEtcMultiWordList = new List<string>(); // case sensitive phrases
|
List<string> _namesEtcMultiWordList = new List<string>(); // case sensitive phrases
|
||||||
List<string> _abbreviationList;
|
List<string> _abbreviationList;
|
||||||
List<string> _userWordList = new List<string>();
|
List<string> _userWordList = new List<string>();
|
||||||
@ -138,6 +139,18 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
|||||||
foreach (string name in _namesEtcList)
|
foreach (string name in _namesEtcList)
|
||||||
_namesEtcListUppercase.Add(name.ToUpper());
|
_namesEtcListUppercase.Add(name.ToUpper());
|
||||||
|
|
||||||
|
_namesEtcListWithApostrophe = new List<string>();
|
||||||
|
if (threeLetterIsoLanguageName.ToLower() == "eng")
|
||||||
|
{
|
||||||
|
foreach (string namesItem in _namesEtcList)
|
||||||
|
{
|
||||||
|
if (!namesItem.EndsWith("s"))
|
||||||
|
_namesEtcListWithApostrophe.Add(namesItem + "'s");
|
||||||
|
else
|
||||||
|
_namesEtcListWithApostrophe.Add(namesItem + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load user words
|
// Load user words
|
||||||
_userWordList = new List<string>();
|
_userWordList = new List<string>();
|
||||||
_userWordListXmlFileName = Utilities.LoadUserWordList(_userWordList, _fiveLetterWordListLanguageName);
|
_userWordListXmlFileName = Utilities.LoadUserWordList(_userWordList, _fiveLetterWordListLanguageName);
|
||||||
@ -976,7 +989,10 @@ namespace Nikse.SubtitleEdit.Logic.OCR
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (word.Length > 2 && _namesEtcListUppercase.IndexOf(word) >= 0)
|
if (word.Length > 2 && _namesEtcListUppercase.IndexOf(word) >= 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (word.Length > 2 && _namesEtcListWithApostrophe.IndexOf(word) >= 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (Utilities.IsInNamesEtcMultiWordList(_namesEtcMultiWordList, line, word))
|
if (Utilities.IsInNamesEtcMultiWordList(_namesEtcMultiWordList, line, word))
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user