title: Python: gensim: RuntimeError: you must first build vocabulary before training the model
body: <p>I know that this question has been asked already, but I was still not able to find a solution for it. </p>
  
  <p>I would like to use gensim's <code>word2vec</code> on a custom data set, but now I'm still figuring out in what format the dataset has to be. I had a look at <a href="http://streamhacker.com/2014/12/29/word2vec-nltk/">this post</a> where the input is basically a list of lists (one big list containing other lists that are tokenized sentences from the NLTK Brown corpus). So I thought that this is the input format I have to use for the command <code>word2vec.Word2Vec()</code>. However, it won't work with my little test set and I don't understand why.</p>
  
  <p>What I have tried:</p>
  
  <p><strong>This worked</strong>:</p>
  
  <pre><code>from gensim.models import word2vec
  from nltk.corpus import brown
  import logging
  logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
  
  brown_vecs = word2vec.Word2Vec(brown.sents())
  </code></pre>
  
  <p><strong>This didn't work</strong>:</p>
  
  <pre><code>sentences = [ "the quick brown fox jumps over the lazy dogs","yoyoyo you go home now to sleep"]
  vocab = [s.encode('utf-8').split() for s in sentences]
  voc_vec = word2vec.Word2Vec(vocab)
  </code></pre>
  
  <p>I don't understand why it doesn't work with the "mock" data, even though it has the same data structure as the sentences from the Brown corpus:</p>
  
  <p><strong>vocab</strong>:</p>
  
  <pre><code>[['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dogs'], ['yoyoyo', 'you', 'go', 'home', 'now', 'to', 'sleep']]
  </code></pre>
  
  <p><strong>brown.sents()</strong>: (the beginning of it)</p>
  
  <pre><code>[['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', 'Friday', 'an', 'investigation', 'of', "Atlanta's", 'recent', 'primary', 'election', 'produced', '``', 'no', 'evidence', "''", 'that', 'any', 'irregularities', 'took', 'place', '.'], ['The', 'jury', 'further', 'said', 'in', 'term-end', 'presentments', 'that', 'the', 'City', 'Executive', 'Committee', ',', 'which', 'had', 'over-all', 'charge', 'of', 'the', 'election', ',', '``', 'deserves', 'the', 'praise', 'and', 'thanks', 'of', 'the', 'City', 'of', 'Atlanta', "''", 'for', 'the', 'manner', 'in', 'which', 'the', 'election', 'was', 'conducted', '.'], ...]
  </code></pre>
  
  <p>Can anyone please tell me what I'm doing wrong? </p>