<p>First, we use the <code>train_unsupervised</code> API to create a <strong>Word-Representation Model</strong>. There are two techniques that we can use, <a href="https://arxiv.org/pdf/1310.4546.pdf" rel="noreferrer">skipgram</a> and <a href="https://arxiv.org/pdf/1301.3781.pdf" rel="noreferrer">cbow</a>. On the other hand, we use the <code>train_supervised</code> API to create <strong>Text Classification Model</strong>. You are asking about the <code>train_supervised</code> API, so I will stick to it.</p>

<p>The way that text classification work in fasttext, is to first represent the word using skipgram by default. Then, use these word-vectors learned from the skipgram model to classify your input text. The two parameters that you asked about (<code>ws</code> and <code>wordNgrams</code>) are related to the skipgram/cbow model.</p>

<p>The following image contains a simplified illustration of how we are using our input text to train skipgram model. Here, we defined the <code>ws</code> parameter as 2 and <code>wordNgrams</code> as 1.</p>

<p><a href="https://i.stack.imgur.com/fYhXF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fYhXF.png" alt="enter image description here"></a></p>

<p>As we can see, we have only one text in our training data which is <code>The quick brown fox jumps over the lazy dog</code>. We defined the context window to be two, which means that we will create a window whose center is <code>center word</code> and the next/previous two words within the window are <code>target words</code>. Then, we move this window a word at a time. The bigger the window size is, the more training samples you have for your model, the more overfitted the model becomes given a small sample of data. </p>

<p>That's for our first argument <code>ws</code>. According to the second argument <code>wordNgrams</code>, if we set <code>wordNgrams</code> to 2, it will consider two-word pairs like the following image. (The <code>ws</code> in the following image is one for simplicity)</p>

<p><a href="https://i.stack.imgur.com/UYRvW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UYRvW.png" alt="enter image description here"></a></p>

<h2>Ref</h2>

<ul>
<li><p>Check this <a href="https://github.com/facebookresearch/fastText/blob/master/python/fasttext_module/fasttext/FastText.py" rel="noreferrer">link</a> which contains the source code for the <code>train_supervised</code> method.</p></li>
<li><p>There is a major difference between skipgram and cbow that can be summarized in the following image:</p></li>
</ul>

<p><a href="https://i.stack.imgur.com/XyR8J.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XyR8J.png" alt="skipgram vs. cbow"></a></p>
Difference between max length of word ngrams and size of context window
<p>In the description of the fasttext library for python <a href="https://github.com/facebookresearch/fastText/tree/master/python" rel="nofollow noreferrer">https://github.com/facebookresearch/fastText/tree/master/python</a> for training a supervised model there are different arguments, where among others are stated as:</p>

<ul>
<li><code>ws</code>: size of the context window</li>
<li><code>wordNgrams</code>: max length of word ngram.</li>
</ul>

<p>If I understand it right, both of them are responsible for taking into account the surrounding words of the word, but what is the clear difference between them?</p>