def _extract_sentinels(kv):
  """Separate out label sentinel accumulators from vocab accumulators.

  To keep track of the frequencies of label values, we store global label
  frequencies associated with a special sentinel value. These are accumulated
  just like other vocabulary tokens, but must be separated out before computing
  mutual information.

  Args:
    kv: tuple of key, accumulator

  Yields:
    A Beam TaggedOutout separating the sentinel and regular tokens.
  """
  token, _ = kv
  if (token == tf_utils.GLOBAL_Y_COUNT_SENTINEL_STRING or
      token == tf_utils.GLOBAL_Y_COUNT_SENTINEL_INT):
    # Throw away the sentinel token, since it's not needed.
    yield beam.pvalue.TaggedOutput('global', kv[1])
  else:
    yield beam.pvalue.TaggedOutput('feature', kv)
Separate out label sentinel accumulators from vocab accumulators.

  To keep track of the frequencies of label values, we store global label
  frequencies associated with a special sentinel value. These are accumulated
  just like other vocabulary tokens, but must be separated out before computing
  mutual information.

  Args:
    kv: tuple of key, accumulator

  Yields:
    A Beam TaggedOutout separating the sentinel and regular tokens.
  
tensorflow_transform/beam/analyzer_impls.py