code: def _validate_build_arguments(max_subword_length, reserved_tokens,
                                target_vocab_size):
    
    if max_subword_length <= 0:
      raise ValueError(
          "max_subword_length must be > 0. Note that memory and compute for "
          "building the vocabulary scale quadratically in the length of the "
          "longest token.")
    for t in reserved_tokens:
      if t.endswith("_") or not text_encoder.is_mixed_alphanum(t):
        raise ValueError(
            "Reserved tokens must not end with _ and they must contain a mix "
            "of alphanumeric and non-alphanumeric characters. For example, "
            "'<EOS>'.")
    # Minimum vocab size = bytes + pad + 1
    minimum_vocab_size = text_encoder.NUM_BYTES + 1 + 1
    if target_vocab_size < minimum_vocab_size:
      raise ValueError("target_vocab_size must be >= %d. Got %d" %
                       (minimum_vocab_size, target_vocab_size))
docs: Validate arguments for SubwordTextEncoder.build_from_corpus.