public override TagFreqItem <NR>[] OnLoadValue(string path)
        {
            var valueArr = LoadDat(path + ".value.dat");

            if (valueArr != null)
            {
                return(valueArr);
            }

            var valueList = new List <TagFreqItem <NR> >();

            try
            {
                foreach (var line in File.ReadLines(path))
                {
                    var tuple = TagFreqItem <NR> .Create(line);

                    var tfi = new TagFreqItem <NR>();

                    foreach (var p in tuple.Item2)
                    {
                        //tfi.AddLabel((NR)Enum.Parse(typeof(NR), p.Key), p.Value);
                        tfi.labelMap[(NR)Enum.Parse(typeof(NR), p.Key)] = p.Value;
                    }
                    valueList.Add(tfi);
                }
            }
            catch (Exception e)
            {
                return(null);
            }

            return(valueList.ToArray());
        }
Example #2
0
        public override TagFreqItem <NT>[] OnLoadValue(string path)
        {
            var valueArr = LoadDat(path + ".value.dat");

            if (valueArr != null)
            {
                return(valueArr);
            }

            var valueList = new List <TagFreqItem <NT> >();

            try
            {
                foreach (var line in File.ReadLines(path))
                {
                    if (string.IsNullOrWhiteSpace(line))
                    {
                        continue;
                    }
                    var tuple = TagFreqItem <NT> .Create(line);

                    var tfi = new TagFreqItem <NT>();

                    foreach (var p in tuple.Item2)
                    {
                        tfi.labelMap.Add((NT)Enum.Parse(typeof(NT), p.Key), p.Value);
                    }
                    valueList.Add(tfi);
                }
            }
            catch (Exception e)
            {
                // log load error
            }
            return(valueList.ToArray());
        }