Files
jellyfin-jellyfin-1/Emby.Server.Implementations/TextEncoding/NLangDetect/ProbVector.cs

34 lines
721 B
C#
Raw Normal View History

using System;
2017-06-17 18:59:17 -04:00
using System.Collections.Generic;
namespace NLangDetect.Core
{
public class ProbVector
2017-06-17 18:59:17 -04:00
{
private readonly Dictionary<int, double> _dict = new Dictionary<int, double>();
2017-06-17 18:59:17 -04:00
public double this[int key]
2017-06-17 18:59:17 -04:00
{
get
{
return _dict.TryGetValue(key, out var value) ? value : 0.0;
}
2017-06-17 18:59:17 -04:00
set
{
if (Math.Abs(value) < double.Epsilon)
{
if (_dict.ContainsKey(key))
{
_dict.Remove(key);
}
return;
}
_dict[key] = value;
}
}
2017-06-17 18:59:17 -04:00
}
}