Browse Source

Output time to stderr

master
Starbeamrainbowlabs 3 years ago
parent
commit
e7f67d7f5e
Signed by: sbrl GPG Key ID: 1BE5172E637709C2
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      MarkovGrams/Program.cs

+ 5
- 0
MarkovGrams/Program.cs 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":


Loading…
Cancel
Save