code: def generate_final_vocabulary(
      reserved_tokens, char_tokens, curr_tokens
  ):
      """Generates final vocab given reserved, single-character, and current tokens.
  
      Args:
        reserved_tokens: list of strings (tokens) that must be included in vocab
        char_tokens: set of single-character strings
        curr_tokens: string to int dict mapping token to count
  
      Returns:
        list of strings representing final vocabulary
      """
  
      sorted_char_tokens = sorted(list(char_tokens))
      vocab_char_arrays = []
      vocab_char_arrays.extend(reserved_tokens)
      vocab_char_arrays.extend(sorted_char_tokens)
  
      # Sort by count, then alphabetically.
      sorted_tokens = sorted(
          sorted(curr_tokens.items(), key=lambda x: x[0]),
          key=lambda x: x[1],
          reverse=True,
      )
      for token, _ in sorted_tokens:
          vocab_char_arrays.append(token)
  
      seen_tokens = set()
      # Adding unique tokens to list to maintain sorted order.
      vocab_words = []
      for word in vocab_char_arrays:
          if word in seen_tokens:
              continue
          seen_tokens.add(word)
          vocab_words.append(word)
  
      return vocab_words
  
file_path: text/tensorflow_text/tools/wordpiece_vocab/wordpiece_tokenizer_learner_lib.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import List, Optional
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: generate_final_vocabulary(reserved_tokens, char_tokens, curr_tokens) and returns: vocab_words