Ejemplo n.º 1
0
        private static void OutputResults(BigramFlags flags, ICounter counter, long elapsed)
        {
            List <BigramCountValue> counts = counter.BigramCountList();

            switch (flags.Order)
            {
            case "alpha":
                counts.Sort((x, y) => x.Item1.CompareTo(y.Item1));
                break;

            case "freq":
                counts.Sort((x, y) => x.Item2.CompareTo(y.Item2));
                break;

            case "freq_d":
                counts.Sort((x, y) => y.Item2.CompareTo(x.Item2));
                break;

            default:
                break;
            }

            foreach (BigramCountValue val in counts)
            {
                Console.WriteLine(string.Format("{0, -20}\t{1, 10}", val.Item1, val.Item2));
            }

            if (elapsed > 0)
            {
                Console.WriteLine();
                Console.WriteLine(string.Format("Elapsed time: {0} / {1} s", elapsed, ((double)elapsed / Stopwatch.Frequency)));
            }
        }