/// <summary>
 /// Create simple Markov Generator to run tests with
 /// </summary>
 /// <returns></returns>
 public MarkovGenerator InitBaseMarkovGenerator()
 {
     MarkovGenerator gen = new MarkovGenerator(_simpleString,
                                               new GeneratorParams(){
                                                 Punctuation = _defaultPunctuation,
                                                 SentenceEnd = _defaultSentenceEnd,
                                                 Rand = _rand}) ;
     return gen ;
 }
Beispiel #2
0
        static MarkovGenerator TimeMarkovConstructor()
        {
            Stopwatch timer = new Stopwatch() ;
            timer.Start() ;
            MarkovGenerator gen = new MarkovGenerator(System.IO.File.ReadAllText("PrideAndPrejudice.txt"));
            timer.Stop() ;
            double baseGenTime = timer.ElapsedMilliseconds/1000.0 ;

            Console.WriteLine(string.Format("Time to generate a new Markov Gen: {0:0.00} seconds", baseGenTime));
            return gen ;
        }
        public void Test_Constructor_Happy()
        {
            MarkovGenerator gen = new MarkovGenerator("Test Markov Gen More words typing here") ;
            CollectionAssert.AreEquivalent(gen.Punctuation, _defaultPunctuation) ;
            CollectionAssert.AreEquivalent(gen.SentenceEnd, _defaultSentenceEnd) ;

            gen = new MarkovGenerator("Test Markov Gen",
                                      new GeneratorParams()
                                      {Punctuation = new List<char>{'a', 'b'},
                                      	SentenceEnd = new List<char> {'c', 'd'}}) ;
            CollectionAssert.AreEquivalent(gen.Punctuation, new List<char>{'a', 'b'}) ;
            CollectionAssert.AreEquivalent(gen.SentenceEnd, new List<char> {'c', 'd'}) ;
        }
Beispiel #4
0
 public GeneratorFacade(MarkovGenerator gen, Random rand)
 {
     Generator = gen ;
     _rand = rand ;
 }
Beispiel #5
0
 public GeneratorFacade(MarkovGenerator gen)
 {
     Generator = gen ;
     _rand = new Random() ;
 }
Beispiel #6
0
 public GeneratorFacade(MarkovGenerator gen, Random rand)
 {
     Generator = gen;
     _rand     = rand;
 }
Beispiel #7
0
 public GeneratorFacade(MarkovGenerator gen)
 {
     Generator = gen;
     _rand     = new Random();
 }