def _generate_subtokens(
    token_counts, alphabet, min_count, num_iterations=4,
    reserved_tokens=None):
  if reserved_tokens is None:
    reserved_tokens = RESERVED_TOKENS
  subtoken_list = reserved_tokens + list(alphabet)
  max_subtoken_length = 1
  for i in xrange(num_iterations):
    tf.logging.info("\tGenerating subtokens: iteration %d" % i)
    subtoken_dict = _list_to_index_dict(subtoken_list)
    subtoken_counts = _count_and_gen_subtokens(
        token_counts, alphabet, subtoken_dict, max_subtoken_length)
    subtoken_list, max_subtoken_length = _gen_new_subtoken_list(
        subtoken_counts, min_count, alphabet, reserved_tokens)
    tf.logging.info("\tVocab size: %d" % len(subtoken_list))
  return subtoken_list