/// <summary>
        /// Creates a sentence generator which is backed by a Markov chain.
        /// </summary>
        /// <param name="chain">The chain to use. It may be mutated by the generator.</param>
        public Order1SentenceGenerator(IMarkovChain <string> chain)
        {
            _chain = chain;

            // Create marker states which represent the beginning and end of a sentence
            _beginMarker = _chain.FindOrCreateState(StateType.Marker, BeginMarkerName);
            _endMarker   = _chain.FindOrCreateState(StateType.Marker, EndMarkerName);
        }
Exemple #2
0
        /// <summary>
        /// Creates a sentence generator which is backed by a Markov chain.
        /// </summary>
        /// <param name="chain">The chain to use. It may be mutated by the generator.</param>
        public Order2SentenceGenerator(IMarkovChain <WordPair> chain)
        {
            if (chain == null)
            {
                throw new ArgumentNullException(nameof(chain));
            }

            _chain = chain;

            // Create marker states used to represent the beginning and end of a sentence
            _beginMarker = _chain.FindOrCreateState(StateType.Marker, BeginMarkerPair);
            _endMarker   = _chain.FindOrCreateState(StateType.Marker, EndMarkerPair);
        }
Exemple #3
0
 public PipeLine(IMarkovChain markovChain, IReader reader, IRandomWord gettingWordAlgorithm)
 {
     MarkovChain = markovChain;
     Reader      = reader;
     MarkovChain.GettingWordAlgorithm = gettingWordAlgorithm;
 }