code: def _vectorize_data(
      self,
      preprocessor: Preprocessor,
      vectorizer: Vectorizer,
      bucket_generator: BucketGenerator = None,
  ) -> Callable[
      [Iterable[Tuple[str, str]]], Iterable[Tuple[List[int], List[int]]]
  ]:
      def vectorize(raw_data: Iterable[Tuple[str, str]]):
          data_preprocessed = (preprocessor(d) for d in raw_data)
          data_vectorized = (vectorizer(d) for d in data_preprocessed)
          if bucket_generator is None:
              return data_vectorized
          else:
              return bucket_generator(data_vectorized)
  
      return vectorize
  
imports: import datetime
  import logging
  import os
  import tempfile
  from collections import Counter
  from typing import Tuple, List, Iterable, Callable, Dict, Union
  import tensorflow
  import yaml
  from headliner.callbacks.evaluation_callback import EvaluationCallback
  from headliner.callbacks.model_checkpoint_callback import ModelCheckpointCallback
  from headliner.callbacks.tensorboard_callback import TensorboardCallback
  from headliner.callbacks.validation_callback import ValidationCallback
  from headliner.embeddings import read_embedding, embedding_to_matrix
  from headliner.evaluation.scorer import Scorer
  from headliner.losses import masked_crossentropy
  from headliner.model.bert_summarizer import BertSummarizer
  from headliner.model.summarizer import Summarizer
  from headliner.preprocessing.bucket_generator import BucketGenerator
  from headliner.preprocessing.dataset_generator import DatasetGenerator
  from headliner.preprocessing.keras_tokenizer import KerasTokenizer
  from headliner.preprocessing.preprocessor import Preprocessor
  from headliner.preprocessing.vectorizer import Vectorizer
  from headliner.utils.logger import get_logger
label_desc: Use image node_id 5 for calling the Trainer obj's underlying member method code with example usage: obj._vectorize_data(preprocessor, vectorizer, bucket_generator) and returns: vectorize, data_vectorized, bucket_generator