title: Using Sklearn's TfidfVectorizer transform
body: <p>I am trying to get the tf-idf vector for a single document using Sklearn's TfidfVectorizer object. I create a vocabulary based on some training documents and use fit_transform to train the TfidfVectorizer. Then, I want to find the tf-idf vectors for any given testing document. </p>
  
  <pre><code>from sklearn.feature_extraction.text import TfidfVectorizer
  
  self.vocabulary = "a list of words I want to look for in the documents".split()
  self.vect = TfidfVectorizer(sublinear_tf=True, max_df=0.5, analyzer='word', 
                   stop_words='english')
  self.vect.fit_transform(self.vocabulary)
  
  ...
  
  doc = "some string I want to get tf-idf vector for"
  tfidf = self.vect.transform(doc)
  </code></pre>
  
  <p>The problem is that this returns a matrix with n rows where n is the size of my doc string. I want it to return just a single vector representing the tf-idf for the entire string. How can I make this see the string as a single document, rather than each character being a document? Also, I am very new to text mining so if I am doing something wrong conceptually, that would be great to know. Any help is appreciated.</p>