Merge pull request #1366 from ivandrofly/patch-38

Update FixCommonErrors part 2
This commit is contained in:
Nikolaj Olsson 2015-10-17 10:09:53 +02:00
commit f16522b787
5 changed files with 9 additions and 9 deletions

View File

@ -60,9 +60,9 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
set { _encoding = value; }
}
public List<string> GetAbbreviations()
public HashSet<string> GetAbbreviations()
{
return new List<string>();
return new HashSet<string>();
}
}

View File

@ -224,7 +224,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
word.Equals("uds", StringComparison.OrdinalIgnoreCase))
return true;
List<string> abbreviations = callbacks.GetAbbreviations();
HashSet<string> abbreviations = callbacks.GetAbbreviations();
return abbreviations.Contains(word + ".");
}

View File

@ -8,13 +8,13 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
private bool IsAbbreviation(string text, int index, IFixCallbacks callbacks)
{
if (text[index] != '.' && text[index] != '!' && text[index] != '?')
if (text[index] != '.')
return false;
if (index - 3 > 0 && Utilities.AllLettersAndNumbers.Contains(text[index - 1]) && text[index - 2] == '.') // e.g: O.R.
return true;
string word = string.Empty;
var word = string.Empty;
int i = index - 1;
while (i >= 0 && Utilities.AllLetters.Contains(text[i]))
{

View File

@ -12,7 +12,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
void LogStatus(string sender, string message, bool isImportant);
void UpdateFixStatus(int fixes, string message, string xMessage);
bool IsName(string candidate);
List<string> GetAbbreviations();
HashSet<string> GetAbbreviations();
void AddToTotalErrors(int count);
void AddToDeleteIndices(int index);
SubtitleFormat Format { get; }

View File

@ -88,7 +88,7 @@ namespace Nikse.SubtitleEdit.Forms
private bool _batchMode;
private string _autoDetectGoogleLanguage;
private List<string> _namesEtcList;
private List<string> _abbreviationList;
private HashSet<string> _abbreviationList;
private StringBuilder _newLog = new StringBuilder();
private readonly StringBuilder _appliedLog = new StringBuilder();
private int _numberOfImportantLogMessages;
@ -523,13 +523,13 @@ namespace Nikse.SubtitleEdit.Forms
}
}
public List<string> GetAbbreviations()
public HashSet<string> GetAbbreviations()
{
if (_abbreviationList != null)
return _abbreviationList;
MakeSureNamesListIsLoaded();
_abbreviationList = new List<string>();
_abbreviationList = new HashSet<string>();
foreach (string name in _namesEtcList)
{
if (name.EndsWith('.'))