aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs')
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs21
1 files changed, 13 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs
index 5d57e30e1..11ce90c87 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs
@@ -36,7 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
-using System;
namespace UniversalDetector.Core
{
@@ -135,12 +134,14 @@ namespace UniversalDetector.Core
byte[] newbuf = FilterWithEnglishLetters(buf, offset, len);
byte charClass, freq;
- for (int i = 0; i < newbuf.Length; i++) {
+ for (int i = 0; i < newbuf.Length; i++)
+ {
charClass = Latin1_CharToClass[newbuf[i]];
freq = Latin1ClassModel[lastCharClass * CLASS_NUM + charClass];
- if (freq == 0) {
- state = ProbingState.NotMe;
- break;
+ if (freq == 0)
+ {
+ state = ProbingState.NotMe;
+ break;
}
freqCounter[freq]++;
lastCharClass = charClass;
@@ -155,13 +156,17 @@ namespace UniversalDetector.Core
float confidence = 0.0f;
int total = 0;
- for (int i = 0; i < FREQ_CAT_NUM; i++) {
+ for (int i = 0; i < FREQ_CAT_NUM; i++)
+ {
total += freqCounter[i];
}
- if (total <= 0) {
+ if (total <= 0)
+ {
confidence = 0.0f;
- } else {
+ }
+ else
+ {
confidence = freqCounter[3] * 1.0f / total;
confidence -= freqCounter[1] * 20.0f / total;
}