aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-01-16 19:10:42 +0100
committerGitHub <noreply@github.com>2019-01-16 19:10:42 +0100
commit900dc851e6c810f9e1772a6fb901a5a7e2801baf (patch)
tree205bac3cd6df971ee18739e59bd4da0ffe91718b /Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs
parent07a8e49c4b1e4a2dddbaa49ab6f1ff4f271fbf20 (diff)
parent933ef438894ed233fec46badf58dd4f26492e832 (diff)
Merge branch 'dev' into cleanup
Diffstat (limited to 'Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs')
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs44
1 files changed, 22 insertions, 22 deletions
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs
index 5a3496075..65c0f8ca8 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs
@@ -20,7 +20,7 @@
*
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
- * Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
+ * Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -51,11 +51,11 @@ namespace UniversalDetector.Core
private const int NUMBER_OF_SEQ_CAT = 4;
private const int POSITIVE_CAT = NUMBER_OF_SEQ_CAT-1;
private const int NEGATIVE_CAT = 0;
-
+
protected SequenceModel model;
-
- // true if we need to reverse every pair in the model lookup
- bool reversed;
+
+ // true if we need to reverse every pair in the model lookup
+ bool reversed;
// char order of last character
byte lastOrder;
@@ -63,38 +63,38 @@ namespace UniversalDetector.Core
int totalSeqs;
int totalChar;
int[] seqCounters = new int[NUMBER_OF_SEQ_CAT];
-
+
// characters that fall in our sampling range
int freqChar;
-
+
// Optional auxiliary prober for name decision. created and destroyed by the GroupProber
- CharsetProber nameProber;
-
- public SingleByteCharSetProber(SequenceModel model)
+ CharsetProber nameProber;
+
+ public SingleByteCharSetProber(SequenceModel model)
: this(model, false, null)
{
-
+
}
-
- public SingleByteCharSetProber(SequenceModel model, bool reversed,
+
+ public SingleByteCharSetProber(SequenceModel model, bool reversed,
CharsetProber nameProber)
{
this.model = model;
this.reversed = reversed;
this.nameProber = nameProber;
- Reset();
+ Reset();
}
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
int max = offset + len;
-
+
for (int i = offset; i < max; i++) {
byte order = model.GetOrder(buf[i]);
if (order < SYMBOL_CAT_ORDER)
totalChar++;
-
+
if (order < SAMPLE_SIZE) {
freqChar++;
@@ -120,7 +120,7 @@ namespace UniversalDetector.Core
}
return state;
}
-
+
public override void DumpStatus()
{
//Console.WriteLine(" SBCS: {0} [{1}]", GetConfidence(), GetCharsetName());
@@ -146,9 +146,9 @@ namespace UniversalDetector.Core
r = 0.99f;
return r;
}
- return 0.01f;
+ return 0.01f;
}
-
+
public override void Reset()
{
state = ProbingState.Detecting;
@@ -159,12 +159,12 @@ namespace UniversalDetector.Core
totalChar = 0;
freqChar = 0;
}
-
- public override string GetCharsetName()
+
+ public override string GetCharsetName()
{
return (nameProber == null) ? model.CharsetName
: nameProber.GetCharsetName();
}
-
+
}
}