/// <summary>
        /// Indicates to the generator that two words have appeared next to each other in a sentence.
        /// </summary>
        /// <param name="fromWord">The first word.</param>
        /// <param name="toWord">The second word.</param>
        public void FeedWordPair(string fromWord, string toWord)
        {
            var fromIndex = FindOrCreateWord(fromWord);
            var toIndex   = FindOrCreateWord(toWord);

            _chain.AddLink(fromIndex, toIndex, 1);
        }
Пример #2
0
        /// <summary>
        /// Indicates to the generator that three words have appeared next to each other in a sentence.
        /// </summary>
        /// <param name="word1">The first word.</param>
        /// <param name="word2">The second word.</param>
        /// <param name="word3">The third word.</param>
        public void FeedWordTriplet(string word1, string word2, string word3)
        {
            if (word1 == null)
            {
                throw new ArgumentNullException(nameof(word1));
            }
            if (word2 == null)
            {
                throw new ArgumentNullException(nameof(word2));
            }
            if (word3 == null)
            {
                throw new ArgumentNullException(nameof(word3));
            }

            var fromIndex = GetOrCreatePair(word1, word2);
            var toIndex   = GetOrCreatePair(word2, word3);

            _chain.AddLink(fromIndex, toIndex, 1);
        }