title: Scikit Learn TfidfVectorizer : How to get top n terms with highest tf-idf score
body: <p>I am working on keyword extraction problem. Consider the very general case</p>
  <pre><code>from sklearn.feature_extraction.text import TfidfVectorizer
  
  tfidf = TfidfVectorizer(tokenizer=tokenize, stop_words='english')
  
  t = &quot;&quot;&quot;Two Travellers, walking in the noonday sun, sought the shade of a widespreading tree to rest. As they lay looking up among the pleasant leaves, they saw that it was a Plane Tree.
  
  &quot;How useless is the Plane!&quot; said one of them. &quot;It bears no fruit whatever, and only serves to litter the ground with leaves.&quot;
  
  &quot;Ungrateful creatures!&quot; said a voice from the Plane Tree. &quot;You lie here in my cooling shade, and yet you say I am useless! Thus ungratefully, O Jupiter, do men receive their blessings!&quot;
  
  Our best blessings are often the least appreciated.&quot;&quot;&quot;
  
  tfs = tfidf.fit_transform(t.split(&quot; &quot;))
  str = 'tree cat travellers fruit jupiter'
  response = tfidf.transform([str])
  feature_names = tfidf.get_feature_names()
  
  for col in response.nonzero()[1]:
      print(feature_names[col], ' - ', response[0, col])
  </code></pre>
  <p>and this gives me</p>
  <pre><code>  (0, 28)   0.443509712811
    (0, 27)   0.517461475101
    (0, 8)    0.517461475101
    (0, 6)    0.517461475101
  tree  -  0.443509712811
  travellers  -  0.517461475101
  jupiter  -  0.517461475101
  fruit  -  0.517461475101
  </code></pre>
  <p>which is good. For any new document that comes in, is there a way to get the top n terms with the highest tfidf score?</p>