static void PrintTopWordCounts(int top) { using var stream = File.OpenRead(wordCountsPath); var wordCounts = VocabularyAssisstant.DeserializeWordCounts(stream); foreach (var wc in wordCounts.Take(top)) { Console.WriteLine($"{wc.Word}: {wc.Count}"); } }
static void CountWords() { var reader = new CorpusZipReader <IEnumerable <string> >(tokenizedPath, tokenizedDataSerializer); var wordCounts = VocabularyAssisstant.CountWords( reader, s => s.ToLower()); using var stream = CreateOutputStream(wordCountsPath); VocabularyAssisstant.SerializeWordCounts(wordCounts, stream); }