code: def from_json(cls, json_str):
          
          vocab_dict = json.loads(json_str)
  
          unknown_token = vocab_dict.get('unknown_token')
          vocab = cls(unknown_token=unknown_token)
          vocab._idx_to_token = vocab_dict.get('idx_to_token')
          vocab._token_to_idx = vocab_dict.get('token_to_idx')
          if unknown_token:
              vocab._token_to_idx = DefaultLookupDict(vocab._token_to_idx[unknown_token],
                                                      vocab._token_to_idx)
          vocab._reserved_tokens = vocab_dict.get('reserved_tokens')
          vocab._padding_token = vocab_dict.get('padding_token')
          vocab._bos_token = vocab_dict.get('bos_token')
          vocab._eos_token = vocab_dict.get('eos_token')
          return vocab
docs: Deserialize Vocab object from json string.
  
          Parameters
          ----------
          json_str : str
              Serialized json string of a Vocab object.
  
  
          Returns
          -------
          Vocab