class_docstr: Preprocessor for an Average Word Embedding model.
  
  Takes (text, label) data and applies regex tokenization and padding to the
  text to generate (token IDs, label) data.
  
  Attributes:
    seq_len: Length of the input sequence to the model.
    do_lower_case: Whether text inputs should be converted to lower-case.
    vocab: Vocabulary of tokens used by the model.
class_docstr_tok: ["Preprocessor","for","an","Average","Word","Embedding","model",".","Takes","(","text",",","label",")","data","and","applies","regex","tokenization","and","padding","to","the","text","to","generate","(","token","IDs",",","label",")","data",".","Attributes",":","seq_len",":","Length","of","the","input","sequence","to","the","model",".","do_lower_case",":","Whether","text","inputs","should","be","converted","to","lower-case",".","vocab",":","Vocabulary","of","tokens","used","by","the","model","."]
docstr: Tokenizes `text` and pads the tokens to `seq_len`.
  
  Args:
    text: Text to be tokenized and padded.
  
  Returns:
    List of token IDs padded to have length `seq_len`.
docstr_tok: ["Tokenizes","`","text","`","and","pads","the","tokens","to","`","seq_len","`",".","Args",":","text",":","Text","to","be","tokenized","and","padded",".","Returns",":","List","of","token","IDs","padded","to","have","length","`","seq_len","`","."]
code: def _tokenize_and_pad(self, text: str) -> Sequence[int]:
      """Tokenizes `text` and pads the tokens to `seq_len`.
  
      Args:
        text: Text to be tokenized and padded.
  
      Returns:
        List of token IDs padded to have length `seq_len`.
      """
      tokens = self._regex_tokenize(text)
  
      # Gets ids for START, PAD and UNKNOWN tokens.
      start_id = self._vocab[self.START]
      pad_id = self._vocab[self.PAD]
      unknown_id = self._vocab[self.UNKNOWN]
  
      token_ids = [
          self._vocab.get(token, unknown_id) for token in tokens
      ]
      token_ids = [start_id] + token_ids
  
      if len(token_ids) < self._seq_len:
          pad_length = self._seq_len - len(token_ids)
          token_ids = token_ids + pad_length * [pad_id]
      else:
          token_ids = token_ids[: self._seq_len]
      return token_ids
  
imports: import collections
  import hashlib
  import os
  import re
  from typing import Mapping, Sequence, Tuple, Union
  import tensorflow
  import tensorflow_hub
  from mediapipe.model_maker.python.core.data import cache_files
  from mediapipe.model_maker.python.text.text_classifier import bert_tokenizer
  from mediapipe.model_maker.python.text.text_classifier import dataset
label_desc: Use image node_id 5 for calling the AverageWordEmbeddingClassifierPreprocessor obj's underlying member method code with example usage: obj._tokenize_and_pad(text) and returns: token_ids