class_docstr: Rank documents according to input strings.
  
  Args:
      vectorizer: a vectorizer class
      top_n: a number of doc ids to return
      active: whether to return a number specified by :attr:`top_n` (``True``) or all ids
       (``False``)
  
  Attributes:
      top_n: a number of doc ids to return
      vectorizer: an instance of vectorizer class
      active: whether to return a number specified by :attr:`top_n` or all ids
      index2doc: inverted :attr:`doc_index`
      iterator: a dataset iterator used for generating batches while fitting the vectorizer
code: def __init__(
      self,
      vectorizer: HashingTfIdfVectorizer,
      top_n=5,
      active: bool = True,
      **kwargs,
  ):
      self.top_n = top_n
      self.vectorizer = vectorizer
      self.active = active
  
file_path: DeepPavlov/deeppavlov/models/doc_retrieval/tfidf_ranker.py
imports: from logging import getLogger
  from typing import List, Any, Tuple
  import numpy
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.estimator import Component
  from deeppavlov.models.vectorizers.hashing_tfidf_vectorizer import HashingTfIdfVectorizer
label_desc: Use image node_id 1 to create a new TfidfRanker object from inherited base classes: Component with example: obj = TfidfRanker(vectorizer, top_n, active)