code: def save_embedding_vocabs(output_dir, graph, entity_names_file=None):
      """Save entity and relation vocabs to file."""
      # Read entity names
      entity_names = None
      if entity_names_file:
          entity_names = read_entity_name_mapping(entity_names_file)
      # Save entity vocab
      with open(output_dir + "/entity_vocab.tsv", "w+") as f:
          for i in range(graph.ent_vocab_size):
              name = graph.inverse_entity_vocab[i]
              if entity_names and name in entity_names:
                  name += "/" + entity_names[name]
              f.write(name + "\n")
      with open(output_dir + "/relation_vocab.tsv", "w+") as f:
          for i in range(graph.rel_vocab_size):
              f.write(graph.inverse_relation_vocab[i] + "\n")
      if hasattr(graph, "vocab"):
          with open(output_dir + "/word_vocab.tsv", "w+") as f:
              for i in range(graph.word_vocab_size):
                  f.write(graph.inverse_word_vocab[i] + "\n")
  
file_path: neural-structured-learning/research/a2n/utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gzip
  import tensorflow
label_desc: Use image node_id 5 for calling a global function with example usage: save_embedding_vocabs(output_dir, graph, entity_names_file) without return types