aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations/TextEncoding/NLangDetect/ProbVector.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-06-17 18:59:17 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-06-17 18:59:17 -0400
commit0e7cbb04651bd9b65668ca1635a4625640639560 (patch)
tree664fa5a66abb0d492479353da08a95ce6553125f /Emby.Common.Implementations/TextEncoding/NLangDetect/ProbVector.cs
parentc9d7eb9b0482ab26c2d288c460cd5fba3c993e7a (diff)
add subtitle language detection
Diffstat (limited to 'Emby.Common.Implementations/TextEncoding/NLangDetect/ProbVector.cs')
-rw-r--r--Emby.Common.Implementations/TextEncoding/NLangDetect/ProbVector.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Emby.Common.Implementations/TextEncoding/NLangDetect/ProbVector.cs b/Emby.Common.Implementations/TextEncoding/NLangDetect/ProbVector.cs
new file mode 100644
index 000000000..c5a20dbf0
--- /dev/null
+++ b/Emby.Common.Implementations/TextEncoding/NLangDetect/ProbVector.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+
+namespace NLangDetect.Core
+{
+ public class ProbVector
+ {
+ private readonly Dictionary<int, double> _dict = new Dictionary<int, double>();
+
+ public double this[int key]
+ {
+ get
+ {
+ double value;
+
+ return _dict.TryGetValue(key, out value) ? value : 0.0;
+ }
+
+ set
+ {
+ if (Math.Abs(value) < double.Epsilon)
+ {
+ if (_dict.ContainsKey(key))
+ {
+ _dict.Remove(key);
+ }
+
+ return;
+ }
+
+ _dict[key] = value;
+ }
+ }
+ }
+}