title: When creating a gensim vocabulary why did I get "decoding to str: need a bytes-like object, list found" error?
body: <p>I want to download a number of random Wikipedia articles (just the content) in order to introduce some randomness into the corpus and ultimately the topics. Then, I want to add the articles ‘Car’ and ‘Bus’ to the corpus.</p>
  <pre><code>import wikipedia
  
  wikipedia_random_articles = wikipedia.random(5)
  wikipedia_random_articles.append('Car')
  wikipedia_random_articles.append('Bus')
  </code></pre>
  <p>This will return a list of seven article titles. These can then be downloaded:</p>
  <p>wikipedia_articles = []
  for wikipedia_article in wikipedia_random_articles:
  wikipedia_articles.append([wikipedia_article, wikipedia.page(wikipedia_article).content])</p>
  <p>Now, we have to clean, tokenize, and stem the articles. With the help of the NLTK:</p>
  <pre><code>from nltk.stem.porter import PorterStemmer
  from nltk.corpus import stopwords
  from nltk.tokenize import RegexpTokenizer
  
  def clean(article):
      title, document = article
      tokens = RegexpTokenizer(r'\w+').tokenize(document.lower())
      tokens_clean = [token for token in tokens if token not in stopwords.words('english')]
      tokens_stemmed = [PorterStemmer().stem(token) for token in tokens_clean]
      return (title, tokens_stemmed)
  
  wikipedia_articles_clean = list(map(clean, wikipedia_articles))
  </code></pre>
  <p>For the LDA model, we need a document-term matrix (a gensim dictionary) and all articles in vectorized format (we will be using a bag-of-words approach).</p>
  <pre><code>from gensim import corpora, models
  import gensim
  
  article_contents = [article[1] for article in wikipedia_articles_clean]
  dictionary = corpora.Dictionary(article_contents)
  </code></pre>
  <p>In order o constructing a vector representation of an article, I used following code:</p>
  <p>bag_of_words = [dictionary.doc2bow(article_content)]</p>
  <p>But I face with following error in Google Colab:</p>
  <pre><code>&gt; TypeError                                 Traceback (most recent call
  &gt; last) &lt;ipython-input-28-aca107b9a54d&gt; in &lt;module&gt;()
  &gt; ----&gt; 1 bag_of_words = [dictionary.doc2bow(article_contents)]
  &gt; 
  &gt; /usr/local/lib/python3.7/dist-packages/gensim/corpora/dictionary.py in
  &gt; doc2bow(self, document, allow_update, return_missing)
  &gt;     243         counter = defaultdict(int)
  &gt;     244         for w in document:
  &gt; --&gt; 245             counter[w if isinstance(w, unicode) else unicode(w, 'utf-8')] += 1
  &gt;     246 
  &gt;     247         token2id = self.token2id
  &gt; 
  &gt; TypeError: decoding to str: need a bytes-like object, list found
  </code></pre>
  <p>Would you please help me to resolve this issue?</p>