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: Generates vocabulary list in `texts` with size `vocab_size`.
  
  Args:
    texts: All texts (across training and validation data) that will be
      preprocessed by the model.
    vocab_size: Size of the vocab.
  
  Returns:
    The vocab mapping tokens to IDs.
docstr_tok: ["Generates","vocabulary","list","in","`","texts","`","with","size","`","vocab_size","`",".","Args",":","texts",":","All","texts","(","across","training","and","validation","data",")","that","will","be","preprocessed","by","the","model",".","vocab_size",":","Size","of","the","vocab",".","Returns",":","The","vocab","mapping","tokens","to","IDs","."]
code: def _gen_vocab(
      self, texts: Sequence[str], vocab_size: int
  ) -> Mapping[str, int]:
      """Generates vocabulary list in `texts` with size `vocab_size`.
  
      Args:
        texts: All texts (across training and validation data) that will be
          preprocessed by the model.
        vocab_size: Size of the vocab.
  
      Returns:
        The vocab mapping tokens to IDs.
      """
      vocab_counter = collections.Counter()
  
      for text in texts:
          tokens = self._regex_tokenize(text)
          for token in tokens:
              vocab_counter[token] += 1
  
      vocab_freq = vocab_counter.most_common(vocab_size)
      vocab_list = [self.PAD, self.START, self.UNKNOWN] + [
          word for word, _ in vocab_freq
      ]
      return collections.OrderedDict(
          ((v, i) for i, v in enumerate(vocab_list))
      )
  
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 2 for calling the AverageWordEmbeddingClassifierPreprocessor obj's underlying member method code with example usage: obj._gen_vocab(texts, vocab_size) and returns: collections