Example #1
0
        public static void CountForSingleWord(List <string> topWordsList, ISearchRepository searchRepository)
        {
            List <TopOneWord> resultOneWord = new List <TopOneWord>();
            int progress = 0;

            Console.WriteLine(progress);

            var watch = Stopwatch.StartNew();

            foreach (var word in topWordsList)
            {
                resultOneWord.Add(new TopOneWord(word, searchRepository.CountForSingleWord(word)));
                Console.Clear();
                progress++;
                Console.WriteLine(progress);
            }
            watch.Stop();
            Console.Clear();
            Console.WriteLine("Time elapsed: {0:hh\\:mm\\:ss}", watch.Elapsed);

            resultOneWord = resultOneWord.OrderByDescending(x => x.count).ToList();


            foreach (var word in resultOneWord)
            {
                Console.WriteLine(word.word + " " + word.count);
            }
        }
Example #2
0
        public static void CountForSingleWord(List<string> topWordsList, ISearchRepository searchRepository)
        {
            List<TopOneWord> resultOneWord = new List<TopOneWord>();
            int progress = 0;

            Console.WriteLine(progress);

            var watch = Stopwatch.StartNew();

            foreach (var word in topWordsList)
            {
                resultOneWord.Add(new TopOneWord(word, searchRepository.CountForSingleWord(word)));
                Console.Clear();
                progress++;
                Console.WriteLine(progress);
            }
            watch.Stop();
            Console.Clear();
            Console.WriteLine("Time elapsed: {0:hh\\:mm\\:ss}", watch.Elapsed);

            resultOneWord = resultOneWord.OrderByDescending(x => x.count).ToList();

            foreach (var word in resultOneWord)
            {
                Console.WriteLine(word.word + " " + word.count);
            }
        }