The situation you are describing considers 3-grams, that is the statistical frequency of a 3-tuple in a given dataset. To create a Markov matrix with no adsorbing states, that is no points where a f_2(w1,w2) -> w3
and f_2(w2,w3) = 0
, you'll have to extend the possibilities. A generalized extension to @ThomasW's answers would be:
- If the set predictor
f_2(w1,w2) != 0
draw from that
- If the set predictor
f_1(w2) != 0
draw from that
- If the set predictor
f_0() != 0
draw from that
That is, draw like normally from the 3-gram set, than the 2-gram set than the 1-gram set. At the last step you'll simply be drawing a word at random weighted by it's statistical frequency.