Output time to stderr

This commit is contained in:
Starbeamrainbowlabs 2018-02-17 21:26:27 +00:00
parent b2bfa0c6e4
commit e7f67d7f5e
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
@ -54,10 +55,12 @@ namespace MarkovGrams
words = File.ReadLines(wordlistFilename).SelectMany(word => word.Trim().Split(' '));
ngrams = NGrams.GenerateFlat(words, order);
Stopwatch utimer = Stopwatch.StartNew();
UnweightedMarkovChain chain = new UnweightedMarkovChain(ngrams);
for(int i = 0; i < count; i++)
Console.WriteLine(chain.Generate(desiredStringLength));
Console.Error.WriteLine($"{count} words in {utimer.ElapsedMilliseconds}ms");
break;
case "markov-w":
@ -81,10 +84,12 @@ namespace MarkovGrams
words = File.ReadLines(wordlistFilename).SelectMany(word => word.Trim().Split(' '));
ngrams = NGrams.GenerateFlat(words, order);
Stopwatch wtimer = Stopwatch.StartNew();
WeightedMarkovChain weightedChain = new WeightedMarkovChain(ngrams);
for (int i = 0; i < weightedCount; i++)
Console.WriteLine(weightedChain.Generate(weightedDesiredStringLength));
Console.Error.WriteLine($"{weightedCount} words in {wtimer.ElapsedMilliseconds}ms");
break;
case "ngrams":