code: def prepare_ext_vocab(self, batch_graph, src_vocab, device):
      oov_dict = copy.deepcopy(src_vocab)
      token_matrix = []
      for n in batch_graph.node_attributes:
          node_token = n["token"]
          if (
              n.get("type") is None or n.get("type") == 0
          ) and oov_dict.get_symbol_idx(
              node_token
          ) == oov_dict.get_symbol_idx(
              oov_dict.unk_token
          ):
              oov_dict.add_symbol(node_token)
          token_matrix.append(oov_dict.get_symbol_idx(node_token))
      batch_graph.node_features["token_id_oov"] = torch.tensor(
          token_matrix, dtype=torch.long
      ).to(device)
      return oov_dict
  
file_path: graph4nlp/graph4nlp/pytorch/inference_wrapper/generator_inference_wrapper_for_tree.py
imports: import copy
  import math
  import warnings
  import torch
  from graph4nlp.pytorch.data.dataset import Text2TreeDataItem, Text2TreeDataset
  from graph4nlp.pytorch.modules.utils.generic_utils import all_to_cuda
  from .base import InferenceWrapperBase
label_desc: Use image node_id 2 for calling the GeneratorInferenceWrapper obj's underlying member method code with example usage: obj.prepare_ext_vocab(batch_graph, src_vocab, device) and returns: oov_dict