mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Merge pull request #1366 from ivandrofly/patch-38
Update FixCommonErrors part 2
This commit is contained in:
commit
f16522b787
@ -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>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 + ".");
|
||||
}
|
||||
|
||||
|
@ -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]))
|
||||
{
|
||||
|
@ -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; }
|
||||
|
@ -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('.'))
|
||||
|
Loading…
Reference in New Issue
Block a user