title: fasttext - Extracting and comparing pre-trained word vectors
body: <p>I'm working with the German pre-trained word vectors from <a href="https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md" rel="nofollow noreferrer">https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md</a></p>
  
  <p>I encountered the following problems:</p>
  
  <ol>
  <li>To extract the vectors for my words, I started by simply searching the <code>wiki.de.vec</code> text-file for the respective words. However, vectors in the <code>wiki.de.vec</code> text-file differ from those that the <code>print-word-vectors</code> function outputs (e.g. the vector for 'affe' meaning 'monkey' is different in the <code>wiki.de.vec</code> file than the output for 'affe' from <code>print-word-vectors</code>). What is the reason for this? I assume this occurs because the vector for a word is computed by adding the sum of its character <em>n</em>-gram vectors in the model by Bojanowski et al., but what does the vector for 'affe' in the <code>wiki.de.vec</code> text-file reflect then? Is it the vector for the <em>n</em>-gram 'affe' that also occurs in other words like 'karaffe'. So, should one always use the <code>print-word-vectors</code> function (i.e. add the character <em>n</em>-gram vectors) when working with these vectors and <em>not</em> simply extract vectors from the text-file?</li>
  <li>Some real German words (e.g. knatschen, resonieren) receive a null vector (even with the <code>print-word-vectors</code> function). How can this be if the major advantage of this subword approach is to compute vectors for out-of-vocabulary words?</li>
  <li>The nearest-neighbors function (<code>./fasttext nn</code>) outputs the nearest-neighbors of a word with the cosine distance. However, this value differs from the value I obtain by getting the vectors of the individual words with <code>print-word-vectors</code> and computing their cosine distance manually in Matlab using <code>pdist2(wordVector1, wordVector2, 'cosine')</code>. Why is this the case? Is this the wrong way to obtain the cosine distance between two word vectors?</li>
  </ol>
  
  <p>Thanks in advance for your help and suggestions!</p>