Output time to stderr
This commit is contained in:
parent
b2bfa0c6e4
commit
e7f67d7f5e
1 changed files with 5 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -54,10 +55,12 @@ namespace MarkovGrams
|
||||||
words = File.ReadLines(wordlistFilename).SelectMany(word => word.Trim().Split(' '));
|
words = File.ReadLines(wordlistFilename).SelectMany(word => word.Trim().Split(' '));
|
||||||
ngrams = NGrams.GenerateFlat(words, order);
|
ngrams = NGrams.GenerateFlat(words, order);
|
||||||
|
|
||||||
|
Stopwatch utimer = Stopwatch.StartNew();
|
||||||
UnweightedMarkovChain chain = new UnweightedMarkovChain(ngrams);
|
UnweightedMarkovChain chain = new UnweightedMarkovChain(ngrams);
|
||||||
|
|
||||||
for(int i = 0; i < count; i++)
|
for(int i = 0; i < count; i++)
|
||||||
Console.WriteLine(chain.Generate(desiredStringLength));
|
Console.WriteLine(chain.Generate(desiredStringLength));
|
||||||
|
Console.Error.WriteLine($"{count} words in {utimer.ElapsedMilliseconds}ms");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "markov-w":
|
case "markov-w":
|
||||||
|
@ -81,10 +84,12 @@ namespace MarkovGrams
|
||||||
words = File.ReadLines(wordlistFilename).SelectMany(word => word.Trim().Split(' '));
|
words = File.ReadLines(wordlistFilename).SelectMany(word => word.Trim().Split(' '));
|
||||||
ngrams = NGrams.GenerateFlat(words, order);
|
ngrams = NGrams.GenerateFlat(words, order);
|
||||||
|
|
||||||
|
Stopwatch wtimer = Stopwatch.StartNew();
|
||||||
WeightedMarkovChain weightedChain = new WeightedMarkovChain(ngrams);
|
WeightedMarkovChain weightedChain = new WeightedMarkovChain(ngrams);
|
||||||
|
|
||||||
for (int i = 0; i < weightedCount; i++)
|
for (int i = 0; i < weightedCount; i++)
|
||||||
Console.WriteLine(weightedChain.Generate(weightedDesiredStringLength));
|
Console.WriteLine(weightedChain.Generate(weightedDesiredStringLength));
|
||||||
|
Console.Error.WriteLine($"{weightedCount} words in {wtimer.ElapsedMilliseconds}ms");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "ngrams":
|
case "ngrams":
|
||||||
|
|
Loading…
Reference in a new issue