code: def get_graph_nbrhd_embd_text(train_graph, ent, max_text_nbrs):
      """Helper to get neighbor text relations from embedded data."""
      neighborhood = []
      neighborhood_emb = []
      for nbr in train_graph.kg_text_data[ent]:
          for sid in train_graph.kg_text_data[ent][nbr]:
              neighborhood.append(nbr)
              eid = train_graph.emb_id_map[sid]
              neighborhood_emb.append(train_graph.embeddings[eid])
      if not neighborhood:
          neighborhood = [[]]
          neighborhood_emb = [np.zeros(train_graph.embeddings[0].size)]
      neighborhood = np.array(neighborhood, dtype=int)
      neighborhood_emb = np.array(neighborhood_emb, dtype=np.float32)
      if neighborhood.shape[0] > max_text_nbrs:
          ids = np.random.choice(
              np.range(neighborhood.shape[0]),
              size=max_text_nbrs,
              replace=False,
          )
          neighborhood = neighborhood[ids]
          neighborhood_emb = neighborhood_emb[ids]
      else:
          neighborhood = sample_or_pad(
              neighborhood, max_text_nbrs, pad_value=train_graph.ent_pad
          )
          neighborhood_emb = sample_or_pad(
              neighborhood_emb, max_text_nbrs, pad_value=0
          )
  
      return neighborhood, neighborhood_emb
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import clueweb_text_graph
  import numpy
  import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: get_graph_nbrhd_embd_text(train_graph, ent, max_text_nbrs) and returns: neighborhood,  neighborhood_emb