title: Dissociated press algorithm using ngram
body: <p>I solve that kind of algorithm, and stuck how does algorithm works.</p>
  <p>Dissociated press algorithm is <a href="https://en.wikipedia.org/wiki/Dissociated_press" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Dissociated_press</a></p>
  <p>N gram - <a href="https://en.wikipedia.org/wiki/N-gram" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/N-gram</a></p>
  <p>can make possible random string in consecutive string, so It can be implemented.</p>
  <blockquote>
  <p>The dissociated press algorithm starts by printing a random n-gram.
  Then it takes the last n-1 words it has printed, and chooses a random
  n-gram that starts with these n-1 words. It prints the last word of
  this n-gram, and repeats. So every consecutive n words of the output
  text are an n-gram of the original text. In can sometimes happen that
  the original text contains no n-gram starting with the n-1 words just
  printed. In this case, the algorithm simply stops.</p>
  </blockquote>
  <p>actually I don't know. how It is terminated.</p>
  <pre><code>ngram(1,2) ngram(2,3) ngram (3,4) ........ T T
  </code></pre>
  <p>is any example for me? I can't understand its text.</p>