title: How to increase weight of a word for CountVectorizer
body: <p>I have a document that I tokenized, and then I take another document and I compare the two by calculating their <em>cosine similarity</em>.</p>
  
  <p>However, before I calculate their similarity, I want to increase the weight of one of the words beforehand. I'm thinking of doing this by doubling the count of that word, but I do not know how to do that.</p>
  
  <p>Suppose I have the following...</p>
  
  <pre><code>text = [
      "This is a test",
      "This is something else",
      "This is also a test"
  ]
  
  test = ["This is something"]
  </code></pre>
  
  <p>Next I define the stop words and call <code>CountVectorizer</code> for both sets of documents.</p>
  
  <pre><code>stopWords = set(stopwords.words('english'))
  
  vectorizer = CountVectorizer(stop_words=stopWords)
  
  trainVectorizerArray = vectorizer.fit_transform(text).toarray()
  testVectorizerArray = vectorizer.transform(test).toarray()
  </code></pre>
  
  <p>In the next part I calculate the <em>cosine similarity</em>...</p>
  
  <pre><code>cosine_function = lambda a, b : round(np.inner(a, b)/(LA.norm(a)*LA.norm(b)), 3)
  
  for vector in trainVectorizerArray:
      print(vector)
      for testV in testVectorizerArray:
          print(testV)
          cosine = cosine_function(vector, testV)
          print(cosine)
  </code></pre>
  
  <p>However, before I calculate the similarity, how can I increase the weight of one of the words. Suppose in this example I want to increase the weight of <code>something</code>, how can I do that? I think you do this by increasing the word count but I do not know how to increase that.</p>