class_docstr: The class implements the functionality of embedding the sentence         as a weighted average by special coefficients of tokens embeddings.         Coefficients can be taken from the given TFIDF-vectorizer in ``vectorizer`` or         calculated as TFIDF from counter vocabulary given in ``counter_vocab_path``.
      Also one can give ``tags_vocab_path`` to the vocabulary with weights of tags.         In this case, batch with tags should be given as a second input in ``__call__`` method.
  
  Args:
      embedder: embedder instance
      tokenizer: tokenizer instance, should be able to detokenize sentence
      pad_zero: whether to pad samples or not
      mean: whether to return mean token embedding
      tags_vocab_path: optional path to vocabulary with tags weights
      vectorizer: vectorizer instance should be trained with ``analyzer="word"``
      counter_vocab_path: path to counter vocabulary
      idf_base_count: minimal idf value (less time occured are not counted)
      log_base: logarithm base for TFIDF-coefficient calculation froom counter vocabulary
      min_idf_weight: minimal idf weight
  
  Attributes:
      embedder: embedder instance
      tokenizer: tokenizer instance, should be able to detokenize sentence
      dim: dimension of embeddings
      pad_zero: whether to pad samples or not
      mean: whether to return mean token embedding
      tags_vocab: vocabulary with weigths for tags
      vectorizer: vectorizer instance
      counter_vocab_path: path to counter vocabulary
      counter_vocab: counter vocabulary
      idf_base_count: minimal idf value (less time occured are not counted)
      log_base: logarithm base for TFIDF-coefficient calculation froom counter vocabulary
      min_idf_weight: minimal idf weight
  
  Examples:
      >>> from deeppavlov.models.embedders.tfidf_weighted_embedder import TfidfWeightedEmbedder
      >>> from deeppavlov.models.embedders.fasttext_embedder import FasttextEmbedder
      >>> fasttext_embedder = FasttextEmbedder('/data/embeddings/wiki.ru.bin')
      >>> fastTextTfidf = TfidfWeightedEmbedder(embedder=fasttext_embedder,
              counter_vocab_path='/data/vocabs/counts_wiki_lenta.txt')
      >>> fastTextTfidf([['большой', 'и', 'розовый', 'бегемот']])
      [array([ 1.99135890e-01, -7.14746421e-02,  8.01428872e-02, -5.32840924e-02,
               5.05212297e-02,  2.76053832e-01, -2.53270134e-01, -9.34443950e-02,
               ...
               1.18385439e-02,  1.05643446e-01, -1.21904516e-03,  7.70555378e-02])]
class_docstr_tok: ["The","class","implements","the","functionality","of","embedding","the","sentence","as","a","weighted","average","by","special","coefficients","of","tokens","embeddings",".","Coefficients","can","be","taken","from","the","given","TFIDF-vectorizer","in","``","vectorizer","``","or","calculated","as","TFIDF","from","counter","vocabulary","given","in","``","counter_vocab_path","``",".","Also","one","can","give","``","tags_vocab_path","``","to","the","vocabulary","with","weights","of","tags",".","In","this","case",",","batch","with","tags","should","be","given","as","a","second","input","in","``","__call__","``","method",".","Args",":","embedder",":","embedder","instance","tokenizer",":","tokenizer","instance",",","should","be","able","to","detokenize","sentence","pad_zero",":","whether","to","pad","samples","or","not","mean",":","whether","to","return","mean","token","embedding","tags_vocab_path",":","optional","path","to","vocabulary","with","tags","weights","vectorizer",":","vectorizer","instance","should","be","trained","with","``","analyzer=","''","word","''","``","counter_vocab_path",":","path","to","counter","vocabulary","idf_base_count",":","minimal","idf","value","(","less","time","occured","are","not","counted",")","log_base",":","logarithm","base","for","TFIDF-coefficient","calculation","froom","counter","vocabulary","min_idf_weight",":","minimal","idf","weight","Attributes",":","embedder",":","embedder","instance","tokenizer",":","tokenizer","instance",",","should","be","able","to","detokenize","sentence","dim",":","dimension","of","embeddings","pad_zero",":","whether","to","pad","samples","or","not","mean",":","whether","to","return","mean","token","embedding","tags_vocab",":","vocabulary","with","weigths","for","tags","vectorizer",":","vectorizer","instance","counter_vocab_path",":","path","to","counter","vocabulary","counter_vocab",":","counter","vocabulary","idf_base_count",":","minimal","idf","value","(","less","time","occured","are","not","counted",")","log_base",":","logarithm","base","for","TFIDF-coefficient","calculation","froom","counter","vocabulary","min_idf_weight",":","minimal","idf","weight","Examples",":",">",">",">","from","deeppavlov.models.embedders.tfidf_weighted_embedder","import","TfidfWeightedEmbedder",">",">",">","from","deeppavlov.models.embedders.fasttext_embedder","import","FasttextEmbedder",">",">",">","fasttext_embedder","=","FasttextEmbedder","(","'\/data\/embeddings\/wiki.ru.bin","'",")",">",">",">","fastTextTfidf","=","TfidfWeightedEmbedder","(","embedder=fasttext_embedder",",","counter_vocab_path='\/data\/vocabs\/counts_wiki_lenta.txt","'",")",">",">",">","fastTextTfidf","(","[","[","'\u0431\u043e\u043b\u044c\u0448\u043e\u0439","'",",","'","\u0438","'",",","'\u0440\u043e\u0437\u043e\u0432\u044b\u0439","'",",","'\u0431\u0435\u0433\u0435\u043c\u043e\u0442","'","]","]",")","[","array","(","[","1.99135890e-01",",","-7.14746421e-02",",","8.01428872e-02",",","-5.32840924e-02",",","5.05212297e-02",",","2.76053832e-01",",","-2.53270134e-01",",","-9.34443950e-02",",","...","1.18385439e-02",",","1.05643446e-01",",","-1.21904516e-03",",","7.70555378e-02","]",")","]"]
docstr: Load tag vocabulary from the given path, each key of the vocabulary is a tag,             and the corresponding value of the item is a coefficient of words with such tags to be multiplied for.
  
  Args:
      load_path: path to the vocabulary to be load from
  
  Returns:
      vocabulary
docstr_tok: ["Load","tag","vocabulary","from","the","given","path",",","each","key","of","the","vocabulary","is","a","tag",",","and","the","corresponding","value","of","the","item","is","a","coefficient","of","words","with","such","tags","to","be","multiplied","for",".","Args",":","load_path",":","path","to","the","vocabulary","to","be","load","from","Returns",":","vocabulary"]
code: def load_tags_vocab(load_path: str) -> dict:
      """
          Load tag vocabulary from the given path, each key of the vocabulary is a tag, \
              and the corresponding value of the item is a coefficient of words with such tags to be multiplied for.
  
          Args:
              load_path: path to the vocabulary to be load from
  
          Returns:
              vocabulary
          """
      tags_vocab = dict()
      with open(load_path, "r") as f:
          lines = f.readlines()
          f.close()
  
      for line in lines:
          key, val = line[:-1].split(" ")  # "\t"
          tags_vocab[key] = val
  
      return tags_vocab
  
file_path: DeepPavlov/deeppavlov/models/embedders/tfidf_weighted_embedder.py
imports: from logging import getLogger
  from typing import List, Union, Optional, Tuple
  import numpy
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.utils import zero_pad
  from deeppavlov.core.models.component import Component
label_desc: Use image node_id 2 for calling the TfidfWeightedEmbedder obj's underlying member method code with example usage: obj.load_tags_vocab(load_path) and returns: tags_vocab