def get_clean_output_mask(output_vocab_filepath, clean_output_vocab_path):
  """Get the masks for generating only clean actions."""
  regular_output_symbols = _get_vocab_symbols(output_vocab_filepath)
  clean_output_symbols = _get_vocab_symbols(clean_output_vocab_path)

  output_mask = []

  for _ in range(constants.NUM_RESERVED_OUTPUT_SYMBOLS):
    output_mask.append(1)

  for symbol in regular_output_symbols:
    if symbol in clean_output_symbols:
      output_mask.append(1)
    else:
      output_mask.append(0)

  tf.logging.info("Using clean output vocab ")
  tf.logging.info("   original vocab size: " + str(len(regular_output_symbols)))
  tf.logging.info("   after cleaning: " + str(sum(output_mask)))
  return output_mask
Get the masks for generating only clean actions.
language/xsp/model/embeddings.py