code: def set_arg_defaults(args):
      # lexical_dictionaries is the only required argument for vocab reduction
      lexical_dictionaries = getattr(args, "lexical_dictionary", None)
      if hasattr(args, "vocab_reduction_params"):
          # We've already created the vocab reduction params from the bottom-level
          # lexical_dictionaries, num_top_words and
          # max_translation_candidates_per_word args
          return args.vocab_reduction_params
      args.vocab_reduction_params = None
      if lexical_dictionaries is not None:
          num_top_words = getattr(
              args, "num_top_words", NUM_TOP_WORDS_DEFAULT
          )
          max_translation_candidates_per_word = getattr(
              args,
              "max_translation_candidates_per_word",
              MAX_TRANSLATION_CANDIDATES_PER_WORD_DEFAULT,
          )
          args.vocab_reduction_params = {
              "lexical_dictionaries": lexical_dictionaries,
              "num_top_words": num_top_words,
              "max_translation_candidates_per_word": max_translation_candidates_per_word,
          }
          # For less redundant logging when we print out the args Namespace,
          # delete the bottom-level args, since we'll just be dealing with
          # args.vocab_reduction_params from now on
          delattr(args, "lexical_dictionary")
          if hasattr(args, "num_top_words"):
              delattr(args, "num_top_words")
          if hasattr(args, "max_translation_candidates_per_word"):
              delattr(args, "max_translation_candidates_per_word")
  
file_path: translate/pytorch_translate/vocab_reduction.py
imports: import codecs
  import logging
  import numpy
  import torch
  import torch.nn
label_desc: Use image node_id 2 for calling a global function with example usage: set_arg_defaults(args) and returns: args