mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Add "Min gap" to "Statistics" - thx Xy :)
This commit is contained in:
parent
8942581b47
commit
c194be0f59
@ -1,6 +1,6 @@
|
||||
Subtitle Edit Changelog
|
||||
|
||||
3.6.5 (xth February 2022) BETA
|
||||
3.6.5 (xth March 2022) BETA
|
||||
* NEW:
|
||||
* Add audio to text (speech recognition) via Vosk/Kaldi
|
||||
* Split of words-without-spaces (via dictionary) in FCE/OCR - thx Dnkhatri
|
||||
@ -23,6 +23,7 @@
|
||||
* Add new text subtitle format - thx jiunyilin
|
||||
* Add new readonly text subtitle format - thx Aris
|
||||
* Add new Edius subtitle formats - thx Donal
|
||||
* Add "Min gap" to "Statistics" - thx Xy
|
||||
* IMPROVED:
|
||||
* Update Bulgarian translation - thx Калин
|
||||
* Update Italian translation - thx NAMP/bovirus
|
||||
|
@ -2279,8 +2279,8 @@ can edit in same subtitle file (collaboration)</Information>
|
||||
<CpsLineLengthStyleCalcNoSpace>Count all except space</CpsLineLengthStyleCalcNoSpace>
|
||||
<CpsLineLengthStyleCalcCjk>CJK 1, latin 0.5</CpsLineLengthStyleCalcCjk>
|
||||
<CpsLineLengthStyleCalcCjkNoSpace>CJK 1, latin 0.5, space 0</CpsLineLengthStyleCalcCjkNoSpace>
|
||||
<CpsLineLengthStyleCalcIgnoreArabicDiacritics>Ignore Arabic diacritics</CpsLineLengthStyleCalcIgnoreArabicDiacritics>
|
||||
<CpsLineLengthStyleCalcIgnoreArabicDiacriticsNoSpace>Ignore Arabic diacritics/space</CpsLineLengthStyleCalcIgnoreArabicDiacriticsNoSpace>
|
||||
<CpsLineLengthStyleCalcIgnoreArabicDiacriticsCpsOnly>Ignore Arabic diacritics, cps only</CpsLineLengthStyleCalcIgnoreArabicDiacriticsCpsOnly>
|
||||
<CpsLineLengthStyleCalcIgnoreArabicDiacriticsNoSpaceCpsOnly>Ignore Arabic diacritics/space, cps only</CpsLineLengthStyleCalcIgnoreArabicDiacriticsNoSpaceCpsOnly>
|
||||
<MusicSymbol>Music symbol</MusicSymbol>
|
||||
<MusicSymbolsReplace>Music symbols to replace (separate by comma)</MusicSymbolsReplace>
|
||||
<FixCommonOcrErrorsUseHardcodedRules>Fix common OCR errors - also use hard-coded rules</FixCommonOcrErrorsUseHardcodedRules>
|
||||
|
@ -113,16 +113,17 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
double minimumCharsSec = 100000000;
|
||||
double maximumCharsSec = 0;
|
||||
double totalCharsSec = 0;
|
||||
foreach (Paragraph p in _subtitle.Paragraphs)
|
||||
var minimalGap = double.MaxValue;
|
||||
foreach (var p in _subtitle.Paragraphs)
|
||||
{
|
||||
allText.Append(p.Text);
|
||||
|
||||
int len = GetLineLength(p);
|
||||
var len = GetLineLength(p);
|
||||
minimumLineLength = Math.Min(minimumLineLength, len);
|
||||
maximumLineLength = Math.Max(len, maximumLineLength);
|
||||
totalLineLength += len;
|
||||
|
||||
double duration = p.Duration.TotalMilliseconds;
|
||||
var duration = p.Duration.TotalMilliseconds;
|
||||
minimumDuration = Math.Min(duration, minimumDuration);
|
||||
maximumDuration = Math.Max(duration, maximumDuration);
|
||||
totalDuration += duration;
|
||||
@ -132,7 +133,17 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
maximumCharsSec = Math.Max(charsSec, maximumCharsSec);
|
||||
totalCharsSec += charsSec;
|
||||
|
||||
foreach (string line in p.Text.SplitToLines())
|
||||
var next = _subtitle.GetParagraphOrDefault(_subtitle.GetIndex(p) + 1);
|
||||
if (next != null)
|
||||
{
|
||||
var gap = next.StartTime.TotalMilliseconds - p.EndTime.TotalMilliseconds;
|
||||
if (gap < minimalGap)
|
||||
{
|
||||
minimalGap = gap;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var line in p.Text.SplitToLines())
|
||||
{
|
||||
var l = GetSingleLineLength(line);
|
||||
minimumSingleLineLength = Math.Min(l, minimumSingleLineLength);
|
||||
@ -152,7 +163,7 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
int sourceLength = _subtitle.ToText(_format).Length;
|
||||
var sourceLength = _subtitle.ToText(_format).Length;
|
||||
var allTextToLower = allText.ToString().ToLowerInvariant();
|
||||
|
||||
sb.AppendLine(string.Format(_l.NumberOfLinesX, _subtitle.Paragraphs.Count));
|
||||
@ -160,6 +171,15 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
sb.AppendLine(string.Format(_l.NumberOfCharactersInTextOnly, allText.ToString().CountCharacters(false)));
|
||||
sb.AppendLine(string.Format(_l.TotalDuration, new TimeCode(totalDuration).ToDisplayString()));
|
||||
sb.AppendLine(string.Format(_l.TotalCharsPerSecond, (double)allText.ToString().CountCharacters(true) / (totalDuration / TimeCode.BaseUnit)));
|
||||
if (Math.Abs(minimalGap - double.MaxValue) < 0.1)
|
||||
{
|
||||
sb.AppendLine(string.Format(_l.MinimalGap, "?"));
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(string.Format(_l.MinimalGap, minimalGap));
|
||||
}
|
||||
|
||||
sb.AppendLine(string.Format(_l.TotalWords, _totalWords));
|
||||
sb.AppendLine(string.Format(_l.NumberOfItalicTags, Utilities.CountTagInText(allTextToLower, "<i>")));
|
||||
sb.AppendLine(string.Format(_l.NumberOfBoldTags, Utilities.CountTagInText(allTextToLower, "<b>")));
|
||||
@ -170,7 +190,7 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
sb.AppendLine(string.Format(_l.LineLengthMinimum, minimumLineLength) + " (" + GetIndicesWithLength(minimumLineLength) + ")");
|
||||
sb.AppendLine(string.Format(_l.LineLengthMaximum, maximumLineLength) + " (" + GetIndicesWithLength(maximumLineLength) + ")");
|
||||
sb.AppendLine(string.Format(_l.LineLengthAverage, totalLineLength / _subtitle.Paragraphs.Count));
|
||||
sb.AppendLine(string.Format(_l.LinesPerSubtitleAverage, (((double)totalSingleLines) / _subtitle.Paragraphs.Count)));
|
||||
sb.AppendLine(string.Format(_l.LinesPerSubtitleAverage, (double)totalSingleLines / _subtitle.Paragraphs.Count));
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(string.Format(_l.SingleLineLengthMinimum, minimumSingleLineLength) + " (" + GetIndicesWithSingleLineLength(minimumSingleLineLength) + ")");
|
||||
sb.AppendLine(string.Format(_l.SingleLineLengthMaximum, maximumSingleLineLength) + " (" + GetIndicesWithSingleLineLength(maximumSingleLineLength) + ")");
|
||||
@ -216,7 +236,7 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
private string GetIndicesWithDuration(double duration)
|
||||
{
|
||||
var indices = new List<string>();
|
||||
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
for (var i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
{
|
||||
var p = _subtitle.Paragraphs[i];
|
||||
if (Math.Abs(p.Duration.TotalMilliseconds - duration) < 0.01)
|
||||
@ -235,7 +255,7 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
private string GetIndicesWithCps(double cps)
|
||||
{
|
||||
var indices = new List<string>();
|
||||
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
for (var i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
{
|
||||
var p = _subtitle.Paragraphs[i];
|
||||
if (Math.Abs(Utilities.GetCharactersPerSecond(p) - cps) < 0.01)
|
||||
@ -254,7 +274,7 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
private string GetIndicesWithLength(int length)
|
||||
{
|
||||
var indices = new List<string>();
|
||||
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
for (var i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
{
|
||||
var p = _subtitle.Paragraphs[i];
|
||||
if (GetLineLength(p) == length)
|
||||
@ -273,7 +293,7 @@ https://github.com/SubtitleEdit/subtitleedit
|
||||
private string GetIndicesWithSingleLineLength(int length)
|
||||
{
|
||||
var indices = new List<string>();
|
||||
for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
for (var i = 0; i < _subtitle.Paragraphs.Count; i++)
|
||||
{
|
||||
var p = _subtitle.Paragraphs[i];
|
||||
foreach (var line in p.Text.SplitToLines())
|
||||
|
@ -3070,6 +3070,7 @@ can edit in same subtitle file (collaboration)",
|
||||
CharactersPerSecondMinimum = "Characters/sec - minimum: {0:0.000}",
|
||||
CharactersPerSecondMaximum = "Characters/sec - maximum: {0:0.000}",
|
||||
CharactersPerSecondAverage = "Characters/sec - average: {0:0.000}",
|
||||
MinimalGap = "Minimal gap: {0} ms",
|
||||
Export = "Export...",
|
||||
};
|
||||
|
||||
|
@ -2919,6 +2919,7 @@
|
||||
public string CharactersPerSecondMinimum { get; set; }
|
||||
public string CharactersPerSecondMaximum { get; set; }
|
||||
public string CharactersPerSecondAverage { get; set; }
|
||||
public string MinimalGap { get; set; }
|
||||
public string Export { get; set; }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user