class_docstr: Loads a pre-weighted inverted index of token/document terms.
  
  Scores new queries by taking sparse dot products.
docstr: Args:
      tfidf_path: path to saved model file
      strict: fail on empty queries or continue (and return empty result)
code: def __init__(self, tfidf_path=None, strict=True):
      """
      Args:
          tfidf_path: path to saved model file
          strict: fail on empty queries or continue (and return empty result)
      """
      # Load from disk
      logger.info("Loading %s" % tfidf_path)
      matrix, metadata = utils.load_sparse_csr(tfidf_path)
      self.doc_mat = matrix
      self.ngrams = metadata["ngram"]
      self.hash_size = metadata["hash_size"]
      self.tokenizer = tokenizers.get_class(metadata["tokenizer"])()
      self.doc_freqs = metadata["doc_freqs"].squeeze()
      self.doc_dict = metadata.get("doc_dict", None)
      self.num_docs = self.doc_mat.shape[1] - 1
      self.strict = strict
  
file_path: ParlAI/parlai/agents/tfidf_retriever/tfidf_doc_ranker.py
imports: import numpy
  import scipy.sparse
  from .None import utils
  from .None import tokenizers
  from parlai.utils.logging import logger
label_desc: Use image node_id 1 to create a new TfidfDocRanker object from inherited base classes: object with example: obj = TfidfDocRanker(tfidf_path, strict)