def METHOD_NAME(decoded, decoded_paddings, targets, target_paddings, tokenizer):
  word_errors = 0.0
  num_words = 0.0
  decoded_lengths = np.sum(decoded_paddings == 0.0, axis=-1)
  target_lengths = np.sum(target_paddings == 0.0, axis=-1)
  batch_size = targets.shape[0]
  for i in range(batch_size):
    decoded_length = decoded_lengths[i]
    target_length = target_lengths[i]
    decoded_i = decoded[i][:decoded_length]
    target_i = targets[i][:target_length]
    decoded_i = str(tokenizer.detokenize(decoded_i.astype(np.int32)))
    target_i = str(tokenizer.detokenize(target_i.astype(np.int32)))
    target_i = ' '.join(target_i.split())
    target_num_words = len(target_i.split(' '))
    word_errors += edit_distance(decoded_i, target_i)
    num_words += target_num_words
  return word_errors, num_words