mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 05:02:36 +01:00
[NameList] - change NameEtc => names
This commit is contained in:
parent
fef9ed619e
commit
401450e0fd
@ -201,8 +201,8 @@ Note: Do check free disk space.</WaveFileMalformed>
|
||||
<Title>Change casing</Title>
|
||||
<ChangeCasingTo>Change casing to</ChangeCasingTo>
|
||||
<NormalCasing>Normal casing. Sentences begin with uppercase letter.</NormalCasing>
|
||||
<FixNamesCasing>Fix names casing (via Dictionaries\NamesEtc.xml)</FixNamesCasing>
|
||||
<FixOnlyNamesCasing>Fix only names casing (via Dictionaries\NamesEtc.xml)</FixOnlyNamesCasing>
|
||||
<FixNamesCasing>Fix names casing (via Dictionaries\names.xml)</FixNamesCasing>
|
||||
<FixOnlyNamesCasing>Fix only names casing (via Dictionaries\names.xml)</FixOnlyNamesCasing>
|
||||
<OnlyChangeAllUppercaseLines>Only change all upper case lines.</OnlyChangeAllUppercaseLines>
|
||||
<AllUppercase>ALL UPPERCASE</AllUppercase>
|
||||
<AllLowercase>all lowercase</AllLowercase>
|
||||
@ -1015,7 +1015,7 @@ Note: Do check free disk space.</WaveFileMalformed>
|
||||
<FindDoubleWords>Find double words</FindDoubleWords>
|
||||
<FindDoubleLines>Find double lines</FindDoubleLines>
|
||||
<GetDictionaries>Get dictionaries...</GetDictionaries>
|
||||
<AddToNamesEtcList>Add word to names/etc list</AddToNamesEtcList>
|
||||
<AddToNameList>Add word to names/etc list</AddToNameList>
|
||||
</SpellCheck>
|
||||
<Synchronization>
|
||||
<Title>Synchronization</Title>
|
||||
@ -1370,8 +1370,8 @@ Continue?</SubtitleAppendPrompt>
|
||||
<NumberOfWithRemovedLineBreakX>Number of lines with removed line-break: {0}</NumberOfWithRemovedLineBreakX>
|
||||
<BeforeMultipleReplace>Before multiple replace</BeforeMultipleReplace>
|
||||
<NumberOfLinesReplacedX>Number of lines with text replaced: {0}</NumberOfLinesReplacedX>
|
||||
<NameXAddedToNamesEtcList>The name '{0}' was added to names/etc list</NameXAddedToNamesEtcList>
|
||||
<NameXNotAddedToNamesEtcList>The name '{0}' was NOT added to names/etc list</NameXNotAddedToNamesEtcList>
|
||||
<NameXAddedToNameList>The name '{0}' was added to name list</NameXAddedToNameList>
|
||||
<NameXNotAddedToNameList>The name '{0}' was NOT added to name list</NameXNotAddedToNameList>
|
||||
<WordXAddedToUserDic>The word '{0}' was added to the user dictionary</WordXAddedToUserDic>
|
||||
<WordXNotAddedToUserDic>The word '{0}' was NOT added to the user dictionary</WordXNotAddedToUserDic>
|
||||
<OcrReplacePairXAdded>The OCR replace list pair '{0} -> {1}' was added to the OCR replace list</OcrReplacePairXAdded>
|
||||
@ -1806,12 +1806,12 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<UserWordList>User word list</UserWordList>
|
||||
<OcrFixList>OCR fix list</OcrFixList>
|
||||
<Location>Location</Location>
|
||||
<UseOnlineNamesEtc>Use online names etc xml file</UseOnlineNamesEtc>
|
||||
<UseOnlineNames>Use online names xml file</UseOnlineNames>
|
||||
<WordAddedX>Word added: {0}</WordAddedX>
|
||||
<WordAlreadyExists>Word already exists!</WordAlreadyExists>
|
||||
<WordNotFound>Word not found</WordNotFound>
|
||||
<RemoveX>Remove {0}?</RemoveX>
|
||||
<CannotUpdateNamesEtcOnline>Cannot update NamesEtc.xml online!</CannotUpdateNamesEtcOnline>
|
||||
<CannotUpdateNamesOnline>Cannot update names.xml online!</CannotUpdateNamesOnline>
|
||||
<ProxyServerSettings>Proxy server settings</ProxyServerSettings>
|
||||
<ProxyAddress>Proxy address</ProxyAddress>
|
||||
<ProxyAuthentication>Authentication</ProxyAuthentication>
|
||||
@ -1994,7 +1994,7 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<SpellCheckProgress>Spell check [{0}] - {1}</SpellCheckProgress>
|
||||
<EditWholeText>Edit whole text</EditWholeText>
|
||||
<EditWordOnly>Edit word only</EditWordOnly>
|
||||
<AddXToNamesEtc>Add '{0}' to names/etc list</AddXToNamesEtc>
|
||||
<AddXToNames>Add '{0}' to name list</AddXToNames>
|
||||
<AutoFixNames>Auto fix names where only casing differ</AutoFixNames>
|
||||
<CheckOneLetterWords>Prompt for unknown one letter words</CheckOneLetterWords>
|
||||
<TreatINQuoteAsING>Treat word ending " in' " as " ing " (English only)</TreatINQuoteAsING>
|
||||
|
@ -13,7 +13,7 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
private readonly HashSet<string> _blackList;
|
||||
private readonly string _languageName;
|
||||
|
||||
public NamesList(string dictionaryFolder, string languageName, bool useOnlineNamesEtc, string namesEtcUrl)
|
||||
public NamesList(string dictionaryFolder, string languageName, bool useOnlinenames, string namesUrl)
|
||||
{
|
||||
_dictionaryFolder = dictionaryFolder;
|
||||
_languageName = languageName;
|
||||
@ -23,7 +23,7 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
_blackList = new HashSet<string>();
|
||||
|
||||
LoadNamesList(GetLocalNamesFileName()); // e.g: en_names.xml (culture insensitive)
|
||||
if (useOnlineNamesEtc && !string.IsNullOrEmpty(namesEtcUrl))
|
||||
if (useOnlinenames && !string.IsNullOrEmpty(namesUrl))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
AddToDictionary,
|
||||
Abort,
|
||||
ChangeLanguage,
|
||||
AddToNamesEtc,
|
||||
AddToNames,
|
||||
ChangeWholeText
|
||||
}
|
||||
}
|
||||
|
@ -338,8 +338,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
Title = "Change casing",
|
||||
ChangeCasingTo = "Change casing to",
|
||||
NormalCasing = "Normal casing. Sentences begin with uppercase letter.",
|
||||
FixNamesCasing = @"Fix names casing (via Dictionaries\NamesEtc.xml)",
|
||||
FixOnlyNamesCasing = @"Fix only names casing (via Dictionaries\NamesEtc.xml)",
|
||||
FixNamesCasing = @"Fix names casing (via Dictionaries\names.xml)",
|
||||
FixOnlyNamesCasing = @"Fix only names casing (via Dictionaries\names.xml)",
|
||||
OnlyChangeAllUppercaseLines = "Only change all upper case lines.",
|
||||
AllUppercase = "ALL UPPERCASE",
|
||||
AllLowercase = "all lowercase",
|
||||
@ -1271,8 +1271,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
NumberOfWithRemovedLineBreakX = "Number of lines with removed line-break: {0}",
|
||||
BeforeMultipleReplace = "Before multiple replace",
|
||||
NumberOfLinesReplacedX = "Number of lines with text replaced: {0}",
|
||||
NameXAddedToNamesEtcList = "The name '{0}' was added to names/etc list",
|
||||
NameXNotAddedToNamesEtcList = "The name '{0}' was NOT added to names/etc list",
|
||||
NameXAddedToNameList = "The name '{0}' was added to name list",
|
||||
NameXNotAddedToNameList = "The name '{0}' was NOT added to name list",
|
||||
WordXAddedToUserDic = "The word '{0}' was added to the user dictionary",
|
||||
WordXNotAddedToUserDic = "The word '{0}' was NOT added to the user dictionary",
|
||||
OcrReplacePairXAdded = "The OCR replace list pair '{0} -> {1}' was added to the OCR replace list",
|
||||
@ -1502,7 +1502,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
SpellCheck = "&Spell check...",
|
||||
SpellCheckFromCurrentLine = "Spell check from current line...",
|
||||
GetDictionaries = "Get dictionaries...",
|
||||
AddToNamesEtcList = "Add word to names/etc list",
|
||||
AddToNameList = "Add word to names/etc list",
|
||||
},
|
||||
|
||||
Synchronization = new LanguageStructure.Main.MainMenu.SynchronizationkMenu
|
||||
@ -2091,12 +2091,12 @@ can edit in same subtitle file (collaboration)",
|
||||
UserWordList = "User word list",
|
||||
OcrFixList = "OCR fix list",
|
||||
Location = "Location",
|
||||
UseOnlineNamesEtc = "Use online names etc xml file",
|
||||
UseOnlineNames = "Use online names xml file",
|
||||
WordAddedX = "Word added: {0}",
|
||||
WordAlreadyExists = "Word already exists!",
|
||||
RemoveX = "Remove {0}?",
|
||||
WordNotFound = "Word not found",
|
||||
CannotUpdateNamesEtcOnline = "Cannot update NamesEtc.xml online!",
|
||||
CannotUpdateNamesOnline = "Cannot update names.xml online!",
|
||||
ProxyServerSettings = "Proxy server settings",
|
||||
ProxyAddress = "Proxy address",
|
||||
ProxyAuthentication = "Authentication",
|
||||
@ -2287,7 +2287,7 @@ can edit in same subtitle file (collaboration)",
|
||||
SpellCheckProgress = "Spell check [{0}] - {1}",
|
||||
EditWholeText = "Edit whole text",
|
||||
EditWordOnly = "Edit word only",
|
||||
AddXToNamesEtc = "Add '{0}' to names/etc list",
|
||||
AddXToNames = "Add '{0}' to name list",
|
||||
AutoFixNames = "Auto fix names where only casing differ",
|
||||
CheckOneLetterWords = "Prompt for unknown one letter words",
|
||||
TreatINQuoteAsING = "Treat word ending \" in' \" as \" ing \" (English only)",
|
||||
|
@ -2866,11 +2866,11 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Main/NumberOfLinesReplacedX":
|
||||
language.Main.NumberOfLinesReplacedX = reader.Value;
|
||||
break;
|
||||
case "Main/NameXAddedToNamesEtcList":
|
||||
language.Main.NameXAddedToNamesEtcList = reader.Value;
|
||||
case "Main/NameXAddedToNameList":
|
||||
language.Main.NameXAddedToNameList = reader.Value;
|
||||
break;
|
||||
case "Main/NameXNotAddedToNamesEtcList":
|
||||
language.Main.NameXNotAddedToNamesEtcList = reader.Value;
|
||||
case "Main/NameXNotAddedToNameList":
|
||||
language.Main.NameXNotAddedToNameList = reader.Value;
|
||||
break;
|
||||
case "Main/WordXAddedToUserDic":
|
||||
language.Main.WordXAddedToUserDic = reader.Value;
|
||||
@ -3499,8 +3499,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Main/Menu/SpellCheck/GetDictionaries":
|
||||
language.Main.Menu.SpellCheck.GetDictionaries = reader.Value;
|
||||
break;
|
||||
case "Main/Menu/SpellCheck/AddToNamesEtcList":
|
||||
language.Main.Menu.SpellCheck.AddToNamesEtcList = reader.Value;
|
||||
case "Main/Menu/SpellCheck/AddToNameList":
|
||||
language.Main.Menu.SpellCheck.AddToNameList = reader.Value;
|
||||
break;
|
||||
case "Main/Menu/Synchronization/Title":
|
||||
language.Main.Menu.Synchronization.Title = reader.Value;
|
||||
@ -4873,8 +4873,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Settings/Location":
|
||||
language.Settings.Location = reader.Value;
|
||||
break;
|
||||
case "Settings/UseOnlineNamesEtc":
|
||||
language.Settings.UseOnlineNamesEtc = reader.Value;
|
||||
case "Settings/UseOnlineNames":
|
||||
language.Settings.UseOnlineNames = reader.Value;
|
||||
break;
|
||||
case "Settings/WordAddedX":
|
||||
language.Settings.WordAddedX = reader.Value;
|
||||
@ -4888,8 +4888,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "Settings/RemoveX":
|
||||
language.Settings.RemoveX = reader.Value;
|
||||
break;
|
||||
case "Settings/CannotUpdateNamesEtcOnline":
|
||||
language.Settings.CannotUpdateNamesEtcOnline = reader.Value;
|
||||
case "Settings/CannotUpdateNamesOnline":
|
||||
language.Settings.CannotUpdateNamesOnline = reader.Value;
|
||||
break;
|
||||
case "Settings/ProxyServerSettings":
|
||||
language.Settings.ProxyServerSettings = reader.Value;
|
||||
@ -5407,8 +5407,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
case "SpellCheck/EditWordOnly":
|
||||
language.SpellCheck.EditWordOnly = reader.Value;
|
||||
break;
|
||||
case "SpellCheck/AddXToNamesEtc":
|
||||
language.SpellCheck.AddXToNamesEtc = reader.Value;
|
||||
case "SpellCheck/AddXToNames":
|
||||
language.SpellCheck.AddXToNames = reader.Value;
|
||||
break;
|
||||
case "SpellCheck/AutoFixNames":
|
||||
language.SpellCheck.AutoFixNames = reader.Value;
|
||||
|
@ -1142,8 +1142,8 @@
|
||||
public string NumberOfWithRemovedLineBreakX { get; set; }
|
||||
public string BeforeMultipleReplace { get; set; }
|
||||
public string NumberOfLinesReplacedX { get; set; }
|
||||
public string NameXAddedToNamesEtcList { get; set; }
|
||||
public string NameXNotAddedToNamesEtcList { get; set; }
|
||||
public string NameXAddedToNameList { get; set; }
|
||||
public string NameXNotAddedToNameList { get; set; }
|
||||
public string WordXAddedToUserDic { get; set; }
|
||||
public string WordXNotAddedToUserDic { get; set; }
|
||||
public string OcrReplacePairXAdded { get; set; }
|
||||
@ -1370,7 +1370,7 @@
|
||||
public string FindDoubleWords { get; set; }
|
||||
public string FindDoubleLines { get; set; }
|
||||
public string GetDictionaries { get; set; }
|
||||
public string AddToNamesEtcList { get; set; }
|
||||
public string AddToNameList { get; set; }
|
||||
}
|
||||
public class SynchronizationkMenu
|
||||
{
|
||||
@ -1971,12 +1971,12 @@
|
||||
public string UserWordList { get; set; }
|
||||
public string OcrFixList { get; set; }
|
||||
public string Location { get; set; }
|
||||
public string UseOnlineNamesEtc { get; set; }
|
||||
public string UseOnlineNames { get; set; }
|
||||
public string WordAddedX { get; set; }
|
||||
public string WordAlreadyExists { get; set; }
|
||||
public string WordNotFound { get; set; }
|
||||
public string RemoveX { get; set; }
|
||||
public string CannotUpdateNamesEtcOnline { get; set; }
|
||||
public string CannotUpdateNamesOnline { get; set; }
|
||||
public string ProxyServerSettings { get; set; }
|
||||
public string ProxyAddress { get; set; }
|
||||
public string ProxyAuthentication { get; set; }
|
||||
@ -2168,7 +2168,7 @@
|
||||
public string SpellCheckProgress { get; set; }
|
||||
public string EditWholeText { get; set; }
|
||||
public string EditWordOnly { get; set; }
|
||||
public string AddXToNamesEtc { get; set; }
|
||||
public string AddXToNames { get; set; }
|
||||
public string AutoFixNames { get; set; }
|
||||
public string CheckOneLetterWords { get; set; }
|
||||
public string TreatINQuoteAsING { get; set; }
|
||||
|
@ -18,9 +18,9 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
private static readonly char[] SplitChars2 = { ' ', '.', ',', '?', '!', ':', ';', '"', '“', '”', '(', ')', '[', ']', '{', '}', '|', '<', '>', '/', '+', '\r', '\n', '¿', '¡', '…', '—', '–', '♪', '♫', '„', '“', '«', '»', '‹', '›' };
|
||||
|
||||
private readonly NamesList _namesList;
|
||||
private readonly HashSet<string> _namesEtcList;
|
||||
private readonly HashSet<string> _namesEtcListUppercase = new HashSet<string>();
|
||||
private readonly HashSet<string> _namesEtcListWithApostrophe = new HashSet<string>();
|
||||
private readonly HashSet<string> _names;
|
||||
private readonly HashSet<string> _namesListUppercase = new HashSet<string>();
|
||||
private readonly HashSet<string> _namesListWithApostrophe = new HashSet<string>();
|
||||
private readonly HashSet<string> _wordsWithDashesOrPeriods = new HashSet<string>();
|
||||
private readonly HashSet<string> _userWordList = new HashSet<string>();
|
||||
private readonly HashSet<string> _userPhraseList = new HashSet<string>();
|
||||
@ -37,24 +37,24 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
_languageName = languageName;
|
||||
_doSpell = doSpell;
|
||||
_namesList = new NamesList(Configuration.DictionariesDirectory, languageName, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
_namesEtcList = _namesList.GetNames();
|
||||
var namesEtcMultiWordList = _namesList.GetMultiNames();
|
||||
_names = _namesList.GetNames();
|
||||
var namesMultiWordList = _namesList.GetMultiNames();
|
||||
|
||||
foreach (string namesItem in _namesEtcList)
|
||||
_namesEtcListUppercase.Add(namesItem.ToUpper());
|
||||
foreach (string namesItem in _names)
|
||||
_namesListUppercase.Add(namesItem.ToUpper());
|
||||
|
||||
if (languageName.StartsWith("en_", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
foreach (string namesItem in _namesEtcList)
|
||||
foreach (string namesItem in _names)
|
||||
{
|
||||
if (!namesItem.EndsWith('s'))
|
||||
{
|
||||
_namesEtcListWithApostrophe.Add(namesItem + "'s");
|
||||
_namesEtcListWithApostrophe.Add(namesItem + "’s");
|
||||
_namesListWithApostrophe.Add(namesItem + "'s");
|
||||
_namesListWithApostrophe.Add(namesItem + "’s");
|
||||
}
|
||||
else if (!namesItem.EndsWith('\''))
|
||||
{
|
||||
_namesEtcListWithApostrophe.Add(namesItem + "'");
|
||||
_namesListWithApostrophe.Add(namesItem + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,12 +80,12 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
}
|
||||
}
|
||||
// Add names/userdic with "." or " " or "-"
|
||||
foreach (var word in namesEtcMultiWordList)
|
||||
foreach (var word in namesMultiWordList)
|
||||
{
|
||||
if (word.Contains(PeriodAndDash))
|
||||
_wordsWithDashesOrPeriods.Add(word);
|
||||
}
|
||||
foreach (string name in _namesEtcList)
|
||||
foreach (string name in _names)
|
||||
{
|
||||
if (name.Contains(PeriodAndDash))
|
||||
_wordsWithDashesOrPeriods.Add(name);
|
||||
@ -112,23 +112,23 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
|
||||
public void RemoveName(string word)
|
||||
{
|
||||
if (word == null || word.Length <= 1 || !_namesEtcList.Contains(word))
|
||||
if (word == null || word.Length <= 1 || !_names.Contains(word))
|
||||
return;
|
||||
|
||||
_namesEtcList.Remove(word);
|
||||
_namesEtcListUppercase.Remove(word.ToUpper());
|
||||
_names.Remove(word);
|
||||
_namesListUppercase.Remove(word.ToUpper());
|
||||
if (_languageName.StartsWith("en_", StringComparison.Ordinal) && !word.EndsWith('s'))
|
||||
{
|
||||
_namesEtcList.Remove(word + "s");
|
||||
_namesEtcListUppercase.Remove(word.ToUpper() + "S");
|
||||
_names.Remove(word + "s");
|
||||
_namesListUppercase.Remove(word.ToUpper() + "S");
|
||||
}
|
||||
if (!word.EndsWith('s'))
|
||||
{
|
||||
_namesEtcListWithApostrophe.Remove(word + "'s");
|
||||
_namesEtcListUppercase.Remove(word.ToUpper() + "'S");
|
||||
_namesListWithApostrophe.Remove(word + "'s");
|
||||
_namesListUppercase.Remove(word.ToUpper() + "'S");
|
||||
}
|
||||
if (!word.EndsWith('\''))
|
||||
_namesEtcListWithApostrophe.Remove(word + "'");
|
||||
_namesListWithApostrophe.Remove(word + "'");
|
||||
|
||||
_namesList.Remove(word);
|
||||
}
|
||||
@ -252,23 +252,23 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
|
||||
public bool AddName(string word)
|
||||
{
|
||||
if (string.IsNullOrEmpty(word) || _namesEtcList.Contains(word))
|
||||
if (string.IsNullOrEmpty(word) || _names.Contains(word))
|
||||
return false;
|
||||
|
||||
_namesEtcList.Add(word);
|
||||
_namesEtcListUppercase.Add(word.ToUpper());
|
||||
_names.Add(word);
|
||||
_namesListUppercase.Add(word.ToUpper());
|
||||
if (_languageName.StartsWith("en_", StringComparison.Ordinal) && !word.EndsWith('s'))
|
||||
{
|
||||
_namesEtcList.Add(word + "s");
|
||||
_namesEtcListUppercase.Add(word.ToUpper() + "S");
|
||||
_names.Add(word + "s");
|
||||
_namesListUppercase.Add(word.ToUpper() + "S");
|
||||
}
|
||||
if (!word.EndsWith('s'))
|
||||
{
|
||||
_namesEtcListWithApostrophe.Add(word + "'s");
|
||||
_namesEtcListUppercase.Add(word.ToUpper() + "'S");
|
||||
_namesListWithApostrophe.Add(word + "'s");
|
||||
_namesListUppercase.Add(word.ToUpper() + "'S");
|
||||
}
|
||||
if (!word.EndsWith('\''))
|
||||
_namesEtcListWithApostrophe.Add(word + "'");
|
||||
_namesListWithApostrophe.Add(word + "'");
|
||||
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, _languageName, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
namesList.Add(word);
|
||||
@ -294,12 +294,12 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
|
||||
public bool HasName(string word)
|
||||
{
|
||||
return _namesEtcList.Contains(word) || ((word.StartsWith('\'') || word.EndsWith('\'')) && _namesEtcList.Contains(word.Trim('\'')));
|
||||
return _names.Contains(word) || ((word.StartsWith('\'') || word.EndsWith('\'')) && _names.Contains(word.Trim('\'')));
|
||||
}
|
||||
|
||||
public bool HasNameExtended(string word, string text)
|
||||
{
|
||||
return _namesEtcListUppercase.Contains(word) || _namesEtcListWithApostrophe.Contains(word) || _namesList.IsInNamesMultiWordList(text, word);
|
||||
return _namesListUppercase.Contains(word) || _namesListWithApostrophe.Contains(word) || _namesList.IsInNamesMultiWordList(text, word);
|
||||
}
|
||||
|
||||
public bool HasUserWord(string word)
|
||||
|
@ -13,7 +13,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
public int NoOfSkippedWords { get; set; }
|
||||
public int NoOfChangedWords { get; set; }
|
||||
public int NoOfCorrectWords { get; set; }
|
||||
public int NoOfNamesEtc { get; set; }
|
||||
public int NoOfNames { get; set; }
|
||||
public int NoOfAddedWords { get; set; }
|
||||
}
|
||||
}
|
||||
|
8
src/Forms/ChangeCasing.Designer.cs
generated
8
src/Forms/ChangeCasing.Designer.cs
generated
@ -88,9 +88,9 @@
|
||||
this.radioButtonFixOnlyNames.AutoSize = true;
|
||||
this.radioButtonFixOnlyNames.Location = new System.Drawing.Point(11, 88);
|
||||
this.radioButtonFixOnlyNames.Name = "radioButtonFixOnlyNames";
|
||||
this.radioButtonFixOnlyNames.Size = new System.Drawing.Size(283, 17);
|
||||
this.radioButtonFixOnlyNames.Size = new System.Drawing.Size(267, 17);
|
||||
this.radioButtonFixOnlyNames.TabIndex = 6;
|
||||
this.radioButtonFixOnlyNames.Text = "Fix only names casing (via Dictionaries\\NamesEtc.xml)";
|
||||
this.radioButtonFixOnlyNames.Text = "Fix only names casing (via Dictionaries\\names.xml)";
|
||||
this.radioButtonFixOnlyNames.UseVisualStyleBackColor = true;
|
||||
this.radioButtonFixOnlyNames.CheckedChanged += new System.EventHandler(this.RadioButton_CheckedChanged);
|
||||
//
|
||||
@ -101,9 +101,9 @@
|
||||
this.checkBoxFixNames.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.checkBoxFixNames.Location = new System.Drawing.Point(23, 39);
|
||||
this.checkBoxFixNames.Name = "checkBoxFixNames";
|
||||
this.checkBoxFixNames.Size = new System.Drawing.Size(261, 17);
|
||||
this.checkBoxFixNames.Size = new System.Drawing.Size(245, 17);
|
||||
this.checkBoxFixNames.TabIndex = 2;
|
||||
this.checkBoxFixNames.Text = "Fix names casing (via Dictionaries\\NamesEtc.xml)";
|
||||
this.checkBoxFixNames.Text = "Fix names casing (via Dictionaries\\names.xml)";
|
||||
this.checkBoxFixNames.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxOnlyAllUpper
|
||||
|
@ -87,7 +87,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private bool _onlyListFixes = true;
|
||||
private bool _batchMode;
|
||||
private string _autoDetectGoogleLanguage;
|
||||
private HashSet<string> _namesEtcList;
|
||||
private HashSet<string> _nameList;
|
||||
private HashSet<string> _abbreviationList;
|
||||
private readonly StringBuilder _newLog = new StringBuilder();
|
||||
private readonly StringBuilder _appliedLog = new StringBuilder();
|
||||
@ -523,21 +523,21 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
public bool IsName(string candidate)
|
||||
{
|
||||
MakeSureNamesListIsLoaded();
|
||||
return _namesEtcList.Contains(candidate); // O(1)
|
||||
return _nameList.Contains(candidate); // O(1)
|
||||
}
|
||||
|
||||
private void MakeSureNamesListIsLoaded()
|
||||
{
|
||||
if (_namesEtcList == null)
|
||||
if (_nameList == null)
|
||||
{
|
||||
string languageTwoLetterCode = LanguageAutoDetect.AutoDetectGoogleLanguage(Subtitle);
|
||||
// Will contains both one word names and multi names
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, languageTwoLetterCode, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
_namesEtcList = namesList.GetNames();
|
||||
_nameList = namesList.GetNames();
|
||||
// Multi word names.
|
||||
foreach (var name in namesList.GetMultiNames())
|
||||
{
|
||||
_namesEtcList.Add(name);
|
||||
_nameList.Add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -549,7 +549,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
MakeSureNamesListIsLoaded();
|
||||
_abbreviationList = new HashSet<string>();
|
||||
foreach (string name in _namesEtcList)
|
||||
foreach (string name in _nameList)
|
||||
{
|
||||
if (name.EndsWith('.'))
|
||||
_abbreviationList.Add(name);
|
||||
|
@ -1273,7 +1273,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
findDoubleWordsToolStripMenuItem.Text = _language.Menu.SpellCheck.FindDoubleWords;
|
||||
FindDoubleLinesToolStripMenuItem.Text = _language.Menu.SpellCheck.FindDoubleLines;
|
||||
GetDictionariesToolStripMenuItem.Text = _language.Menu.SpellCheck.GetDictionaries;
|
||||
addWordToNamesetcListToolStripMenuItem.Text = _language.Menu.SpellCheck.AddToNamesEtcList;
|
||||
addWordToNamesetcListToolStripMenuItem.Text = _language.Menu.SpellCheck.AddToNameList;
|
||||
|
||||
toolStripMenuItemSynchronization.Text = _language.Menu.Synchronization.Title;
|
||||
toolStripMenuItemAdjustAllTimes.Text = _language.Menu.Synchronization.AdjustAllTimes;
|
||||
@ -13274,9 +13274,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
addToNamesList.Initialize(_subtitle, textBoxListViewText.SelectedText);
|
||||
if (addToNamesList.ShowDialog(this) == DialogResult.OK)
|
||||
ShowStatus(string.Format(_language.NameXAddedToNamesEtcList, addToNamesList.NewName));
|
||||
ShowStatus(string.Format(_language.NameXAddedToNameList, addToNamesList.NewName));
|
||||
else if (!string.IsNullOrEmpty(addToNamesList.NewName))
|
||||
ShowStatus(string.Format(_language.NameXNotAddedToNamesEtcList, addToNamesList.NewName));
|
||||
ShowStatus(string.Format(_language.NameXNotAddedToNameList, addToNamesList.NewName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8302,11 +8302,11 @@ namespace Nikse.SubtitleEdit.Forms.Ocr
|
||||
{
|
||||
comboBoxDictionaries_SelectedIndexChanged(null, null);
|
||||
UpdateUnknownWordColoring(form.NewName, StringComparison.Ordinal);
|
||||
ShowStatus(string.Format(Configuration.Settings.Language.Main.NameXAddedToNamesEtcList, form.NewName));
|
||||
ShowStatus(string.Format(Configuration.Settings.Language.Main.NameXAddedToNameList, form.NewName));
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(form.NewName))
|
||||
{
|
||||
MessageBox.Show(string.Format(Configuration.Settings.Language.Main.NameXNotAddedToNamesEtcList, form.NewName));
|
||||
MessageBox.Show(string.Format(Configuration.Settings.Language.Main.NameXNotAddedToNameList, form.NewName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
buttonAddUserWord.Text = language.AddWord;
|
||||
buttonAddOcrFix.Text = language.AddPair;
|
||||
groupBoxWordListLocation.Text = language.Location;
|
||||
checkBoxNamesEtcOnline.Text = language.UseOnlineNamesEtc;
|
||||
checkBoxNamesEtcOnline.Text = language.UseOnlineNames;
|
||||
linkLabelOpenDictionaryFolder.Text = Configuration.Settings.Language.GetDictionaries.OpenDictionariesFolder;
|
||||
|
||||
groupBoxProxySettings.Text = language.ProxyServerSettings;
|
||||
@ -751,7 +751,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var spellCheckNode = new TreeNode(Configuration.Settings.Language.Main.Menu.SpellCheck.Title);
|
||||
AddNode(spellCheckNode, Configuration.Settings.Language.Main.Menu.SpellCheck.Title, nameof(Configuration.Settings.Shortcuts.MainSpellCheck));
|
||||
AddNode(spellCheckNode, Configuration.Settings.Language.Main.Menu.SpellCheck.FindDoubleWords, nameof(Configuration.Settings.Shortcuts.MainSpellCheckFindDoubleWords));
|
||||
AddNode(spellCheckNode, Configuration.Settings.Language.Main.Menu.SpellCheck.AddToNamesEtcList, nameof(Configuration.Settings.Shortcuts.MainSpellCheckAddWordToNames));
|
||||
AddNode(spellCheckNode, Configuration.Settings.Language.Main.Menu.SpellCheck.AddToNameList, nameof(Configuration.Settings.Shortcuts.MainSpellCheckAddWordToNames));
|
||||
treeViewShortcuts.Nodes.Add(spellCheckNode);
|
||||
|
||||
var syncNode = new TreeNode(Configuration.Settings.Language.Main.Menu.Synchronization.Title);
|
||||
@ -1580,7 +1580,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (removeCount < itemsToRemoveCount && Configuration.Settings.WordLists.UseOnlineNames && !string.IsNullOrEmpty(Configuration.Settings.WordLists.NamesUrl))
|
||||
{
|
||||
MessageBox.Show(Configuration.Settings.Language.Settings.CannotUpdateNamesEtcOnline);
|
||||
MessageBox.Show(Configuration.Settings.Language.Settings.CannotUpdateNamesOnline);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -313,8 +313,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void ButtonAddToNamesClick(object sender, EventArgs e)
|
||||
{
|
||||
PushUndo(string.Format("{0}: {1}", Configuration.Settings.Language.SpellCheck.AddToNamesAndIgnoreList, textBoxWord.Text), SpellCheckAction.AddToNamesEtc);
|
||||
DoAction(SpellCheckAction.AddToNamesEtc);
|
||||
PushUndo(string.Format("{0}: {1}", Configuration.Settings.Language.SpellCheck.AddToNamesAndIgnoreList, textBoxWord.Text), SpellCheckAction.AddToNames);
|
||||
DoAction(SpellCheckAction.AddToNames);
|
||||
}
|
||||
|
||||
private void ButtonEditWholeTextClick(object sender, EventArgs e)
|
||||
@ -352,7 +352,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (!string.IsNullOrWhiteSpace(richTextBoxParagraph.SelectedText))
|
||||
{
|
||||
string word = richTextBoxParagraph.SelectedText.Trim();
|
||||
addXToNamesnoiseListToolStripMenuItem.Text = string.Format(Configuration.Settings.Language.SpellCheck.AddXToNamesEtc, word);
|
||||
addXToNamesnoiseListToolStripMenuItem.Text = string.Format(Configuration.Settings.Language.SpellCheck.AddXToNames, word);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -365,7 +365,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (!string.IsNullOrWhiteSpace(richTextBoxParagraph.SelectedText))
|
||||
{
|
||||
ChangeWord = richTextBoxParagraph.SelectedText.Trim();
|
||||
DoAction(SpellCheckAction.AddToNamesEtc);
|
||||
DoAction(SpellCheckAction.AddToNames);
|
||||
}
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (_spellCheckWordLists.AddUserWord(ChangeWord))
|
||||
_noOfAddedWords++;
|
||||
break;
|
||||
case SpellCheckAction.AddToNamesEtc:
|
||||
case SpellCheckAction.AddToNames:
|
||||
_spellCheckWordLists.AddName(ChangeWord);
|
||||
if (string.Compare(ChangeWord, _currentWord, StringComparison.OrdinalIgnoreCase) != 0)
|
||||
return; // don't prepare next word if change was more than just casing
|
||||
@ -942,7 +942,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
NoOfSkippedWords = _noOfSkippedWords,
|
||||
NoOfChangedWords = _noOfChangedWords,
|
||||
NoOfCorrectWords = _noOfCorrectWords,
|
||||
NoOfNamesEtc = _noOfNamesEtc,
|
||||
NoOfNames = _noOfNamesEtc,
|
||||
NoOfAddedWords = _noOfAddedWords,
|
||||
});
|
||||
buttonUndo.Text = undoText;
|
||||
@ -959,7 +959,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_noOfSkippedWords = undo.NoOfSkippedWords;
|
||||
_noOfChangedWords = undo.NoOfChangedWords;
|
||||
_noOfCorrectWords = undo.NoOfCorrectWords;
|
||||
_noOfNamesEtc = undo.NoOfNamesEtc;
|
||||
_noOfNamesEtc = undo.NoOfNames;
|
||||
_noOfAddedWords = undo.NoOfAddedWords;
|
||||
|
||||
switch (undo.Action)
|
||||
@ -981,7 +981,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
case SpellCheckAction.AddToDictionary:
|
||||
_spellCheckWordLists.RemoveUserWord(undo.UndoWord);
|
||||
break;
|
||||
case SpellCheckAction.AddToNamesEtc:
|
||||
case SpellCheckAction.AddToNames:
|
||||
_spellCheckWordLists.RemoveName(undo.UndoWord);
|
||||
break;
|
||||
case SpellCheckAction.ChangeWholeText:
|
||||
|
Loading…
Reference in New Issue
Block a user