title: CountVectorizer deleting features that only appear once
body: <p>I'm using the sklearn python package, and I am having trouble creating a <code>CountVectorizer</code> with a pre-created dictionary, where the <code>CountVectorizer</code> doesn't delete features that only appear once or don't appear at all.</p>
  
  <p>Here is the sample code that I have:</p>
  
  <pre><code>train_count_vect, training_matrix, train_labels = setup_data(train_corpus, query, vocabulary=None)
  test_count_vect, test_matrix, test_labels = setup_data(test_corpus, query, vocabulary=train_count_vect.get_feature_names())
  
  print(len(train_count_vect.get_feature_names()))
  print(len(test_count_vect.get_feature_names()))
  </code></pre>
  
  <p><code>len(train_count_vect.get_feature_names())</code> outputs <code>89967</code>
  <code>len(test_count_vect.get_feature_names())</code> outputs <code>9833</code></p>
  
  <p>Inside the <code>setup_data()</code> function, I am just initializing <code>CountVectorizer</code>. For training data, I'm initializing it without a preset vocabulary. Then, for test data, I'm initializing CountVectorizer with the vocabulary I retrieved from my training data.</p>
  
  <p>How do I get the vocabularies to be the same lengths? I think sklearn is deleting features because they only appear once or don't appear at all in my test corpus. I need to have the same vocabulary because otherwise, my classifier will be of a different length from my test data points.</p>