title: How to add weight factor to CountVectorizer
body: <p>I am pretty new to data science. I'm trying to solve nlp clustering problem using LDA. I've encountered with problem using <code>CountVectorizer</code> from <strong>sklearn</strong>. </p>
  
  <p>I've got a Data Frame:</p>
  
  <pre><code>df = pd.DataFrame({'id':[1,2,3],'word':[['one', 'two', 'four'],
                                      ['five', 'six', 'nine'], 
                                      ['eight', 'eleven', 'ten']]})
  df2 =  df.copy().assign(word = df.word.map(lambda y: " ".join(y)))
  
  
      id  word
  0   1   one two four
  1   2   five six nine
  2   3   eight eleven ten
  </code></pre>
  
  <p>And I've got a piece of code from <a href="http://ahmedbesbes.com/how-to-mine-newsfeed-data-and-extract-interactive-insights-in-python.html" rel="nofollow noreferrer">web</a> which works good for my problem:</p>
  
  <pre><code>cvectorizer = CountVectorizer(min_df=4, max_features=10000,ngram_range=(1,2))
  cvz = cvectorizer.fit_transform(df2['word'])
  </code></pre>
  
  <p>All I want is to add some kind of weight factor to the values in word column. It should work like this: the first element of an array in word's column should have the weight of <code>len(lengths of an array)</code> and in descending order from the beginning to the end of an array.</p>
  
  <p>For example: for row with id = 1 I want the following situation: </p>
  
  <pre><code>{one:3, two:2, four:1}
  </code></pre>
  
  <p>Where int values is my weight parameters.</p>
  
  <p>And after this I want that weighted values to be pushed into <code>CountVectorizer</code>. </p>
  
  <p>I've read documentation but I just can't get how to solve my problem.</p>