class_docstr: Implements a Bag-of-Words (BoW) model to derive sentence embeddings.
  
  A weighting can be added to allow the generation of tf-idf vectors. The output vector has the size of the vocab.
class_docstr_tok: ["Implements","a","Bag-of-Words","(","BoW",")","model","to","derive","sentence","embeddings",".","A","weighting","can","be","added","to","allow","the","generation","of","tf-idf","vectors",".","The","output","vector","has","the","size","of","the","vocab","."]
code: def get_sentence_features(
      self, tokenized_texts: List[List[int]], pad_seq_length: int = 0
  ):
      vectors = []
  
      for tokens in tokenized_texts:
          vector = np.zeros(
              self.get_sentence_embedding_dimension(), dtype=np.float32
          )
          for token in tokens:
              if self.cumulative_term_frequency:
                  vector[token] += self.weights[token]
              else:
                  vector[token] = self.weights[token]
          vectors.append(vector)
  
      return {
          "sentence_embedding": torch.tensor(vectors, dtype=torch.float)
      }
  
file_path: sentence-transformers/sentence_transformers/models/BoW.py
imports: import torch
  from torch import Tensor
  from torch import nn
  from typing import List, Dict
  import os
  import json
  import logging
  import numpy
  from .tokenizer import WhitespaceTokenizer
label_desc: Use image node_id 5 for calling the BoW obj's underlying member method code with example usage: obj.get_sentence_features(tokenized_texts, pad_seq_length) and returns: dict