public static void CountForPairWords(List <string> topWordsList, ISearchRepository searchRepository) { List <TopPairWords> resultPairWords = new List <TopPairWords>(); int[,] tab = new int[100, 100]; int progress = 0; Console.WriteLine(progress); var watch = Stopwatch.StartNew(); for (int i = 0; i < 100; i++) { for (int j = 0; j < i; j++) { string wordOne = topWordsList.ElementAt(i); string wordTwo = topWordsList.ElementAt(j); resultPairWords.Add(new TopPairWords(wordOne, wordTwo, searchRepository.CountForPairWord(wordOne, wordTwo))); Console.Clear(); progress++; Console.WriteLine(progress); } } watch.Stop(); Console.Clear(); Console.WriteLine("Time elapsed: {0:hh\\:mm\\:ss}", watch.Elapsed); resultPairWords = resultPairWords.OrderByDescending(x => x.count).ToList(); foreach (var pair in resultPairWords) { Console.WriteLine(pair.wordOne + ", " + pair.wordTwo + " " + pair.count); } }
public static void CountForPairWords(List<string> topWordsList, ISearchRepository searchRepository) { List<TopPairWords> resultPairWords = new List<TopPairWords>(); int[,] tab = new int[100, 100]; int progress = 0; Console.WriteLine(progress); var watch = Stopwatch.StartNew(); for (int i = 0; i < 100; i++) { for (int j = 0; j < i; j++) { string wordOne = topWordsList.ElementAt(i); string wordTwo = topWordsList.ElementAt(j); resultPairWords.Add(new TopPairWords(wordOne, wordTwo, searchRepository.CountForPairWord(wordOne, wordTwo))); Console.Clear(); progress++; Console.WriteLine(progress); } } watch.Stop(); Console.Clear(); Console.WriteLine("Time elapsed: {0:hh\\:mm\\:ss}", watch.Elapsed); resultPairWords = resultPairWords.OrderByDescending(x => x.count).ToList(); foreach (var pair in resultPairWords) { Console.WriteLine(pair.wordOne + ", " + pair.wordTwo + " " + pair.count); } }