示例#1
0
        public List <string> Encode(List <string> dictionary, Session session)
        {
            double b = 0;
            // double c = 0;
            var result = new List <string>();

            for (int i = 0; i < dictionary.Count; i++)
            {
                List <bool> encodedSymbol = Root.Traverse(dictionary[i], new List <bool>());
                result.Add(StringManipulator.BitToString(new BitArray(encodedSymbol.ToArray())));

                b += result[i].Length * d[dictionary[i]];
                //c += d[dictionary[i]];
            }
            session.AverageElementLength = b;
            return(result);
        }