title: C# algorithm for N-gram
body: <p>I am intending to use the n-gram code from <a href="http://www.codeproject.com/KB/cs/tfidf.aspx" rel="nofollow">this article</a>. The algorithm produces these tri-gram results:</p>
  
  <pre><code>t, th, the, he, e, q, qu, qui, uic, ick, ck, k, r, re, red, ed, d
  </code></pre>
  
  <p>for the text <code>the quick red</code></p>
  
  <p>However <a href="https://en.wikipedia.org/wiki/Trigram#Examples" rel="nofollow">wikipedia</a>, reckons it should be:</p>
  
  <pre><code>the  qui  k_r
  he_  uic  _re
  e_q  ick  red
  _qu  ck_
  </code></pre>
  
  <p>(space indicated by ‘_’).</p>
  
  <p>What is correct? Are there any other C# implementation out there?</p>