class_docstr: Vocabulary containing character-level information.
class_docstr_tok: ["Vocabulary","containing","character-level","information","."]
code: def __init__(self, filename, max_word_length):
      super(CharsVocabulary, self).__init__(filename)
      self._max_word_length = max_word_length
      chars_set = set()
  
      for word in self._id_to_word:
          chars_set |= set(word)
  
      free_ids = []
      for i in range(256):
          if chr(i) in chars_set:
              continue
          free_ids.append(chr(i))
  
      if len(free_ids) < 5:
          raise ValueError(
              "Not enough free char ids: %d" % len(free_ids)
          )
  
      self.bos_char = free_ids[0]  # <begin sentence>
      self.eos_char = free_ids[1]  # <end sentence>
      self.bow_char = free_ids[2]  # <begin word>
      self.eow_char = free_ids[3]  # <end word>
      self.pad_char = free_ids[4]  # <padding>
  
      chars_set |= {
          self.bos_char,
          self.eos_char,
          self.bow_char,
          self.eow_char,
          self.pad_char,
      }
  
      self._char_set = chars_set
      num_words = len(self._id_to_word)
  
      self._word_char_ids = np.zeros(
          [num_words, max_word_length], dtype=np.int32
      )
  
      self.bos_chars = self._convert_word_to_char_ids(self.bos_char)
      self.eos_chars = self._convert_word_to_char_ids(self.eos_char)
  
      for i, word in enumerate(self._id_to_word):
          self._word_char_ids[i] = self._convert_word_to_char_ids(word)
  
imports: import random
  import numpy
  from textattack.shared.utils import LazyLoader
label_desc: Use image node_id 1 to create a new CharsVocabulary object from inherited base classes: Vocabulary with example: obj = CharsVocabulary(filename, max_word_length)