class_docstr: A class that tokenizes and otherwise processes text to be encoded
  by a BERT model.
docstr: Build vocabulary
  
  :param text: a list of text used to built vocabulary
  :type text: List
docstr_tok: ["Build","vocabulary",":","param","text",":","a","list","of","text","used","to","built","vocabulary",":","type","text",":","List"]
code: def build_vocab(self, text: List[str]):
      """Build vocabulary
  
      :param text: a list of text used to built vocabulary
      :type text: List
      """
      words_to_indexes = {}
      counts = {}
      tokenizer = self.get_tokenizer()
  
      for special_token in tokenizer.all_special_tokens:
          words_to_indexes[
              special_token
          ] = tokenizer.convert_tokens_to_ids(special_token)
          counts[special_token] = self.COUNT_SPECIAL_TOKENS
  
      for sentence in text:
          tokens = self.generate_tokens(sentence)
          ids = tokenizer.encode(sentence, add_special_tokens=False)
          for token, token_id in zip(tokens, ids):
              if token not in words_to_indexes:
                  words_to_indexes[token] = token_id
                  counts[token] = 1
              else:
                  counts[token] += 1
  
      indexes_to_words = {v: k for k, v in words_to_indexes.items()}
  
      max_num = max(words_to_indexes.values())
  
      for i in range(max_num):
          if i not in indexes_to_words:
              token = tokenizer.convert_ids_to_tokens(i)
              indexes_to_words[i] = token
              words_to_indexes[token] = i
              counts[token] = 0
  
      self.word_vocab = words_to_indexes
      self.reverse_word_vocab = indexes_to_words
      self.counts = counts
  
file_path: interpret-text/python/interpret_text/experimental/common/preprocessor/bert_preprocessor.py
imports: import pandas
  from typing import List
  from interpret_text.experimental.common.base_explainer import BaseTextPreprocessor
  from transformers import BertTokenizer
label_desc: Use image node_id 1 for calling the BertPreprocessor obj's underlying member method code with example usage: obj.build_vocab(text) without return types