class_docstr: Construct a LayoutLMv2 tokenizer. Based on WordPiece. [`LayoutLMv2Tokenizer`] can be used to turn words, word-level
  bounding boxes and optional word labels to token-level `input_ids`, `attention_mask`, `token_type_ids`, `bbox`, and
  optional `labels` (for token classification).
  
  This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
  this superclass for more information regarding those methods.
  
  [`LayoutLMv2Tokenizer`] runs end-to-end tokenization: punctuation splitting and wordpiece. It also turns the
  word-level bounding boxes into token-level bounding boxes.
class_docstr_tok: ["Construct","a","LayoutLMv2","tokenizer",".","Based","on","WordPiece",".","[","`","LayoutLMv2Tokenizer","`","]","can","be","used","to","turn","words",",","word-level","bounding","boxes","and","optional","word","labels","to","token-level","`","input_ids","`",",","`","attention_mask","`",",","`","token_type_ids","`",",","`","bbox","`",",","and","optional","`","labels","`","(","for","token","classification",")",".","This","tokenizer","inherits","from","[","`","PreTrainedTokenizer","`","]","which","contains","most","of","the","main","methods",".","Users","should","refer","to","this","superclass","for","more","information","regarding","those","methods",".","[","`","LayoutLMv2Tokenizer","`","]","runs","end-to-end","tokenization",":","punctuation","splitting","and","wordpiece",".","It","also","turns","the","word-level","bounding","boxes","into","token-level","bounding","boxes","."]
code: def save_vocabulary(
      self, save_directory: str, filename_prefix: Optional[str] = None
  ) -> Tuple[str]:
      index = 0
      if os.path.isdir(save_directory):
          vocab_file = os.path.join(
              save_directory,
              (filename_prefix + "-" if filename_prefix else "")
              + VOCAB_FILES_NAMES["vocab_file"],
          )
      else:
          vocab_file = (
              filename_prefix + "-" if filename_prefix else ""
          ) + save_directory
      with open(vocab_file, "w", encoding="utf-8") as writer:
          for token, token_index in sorted(
              self.vocab.items(), key=lambda kv: kv[1]
          ):
              if index != token_index:
                  logger.warning(
                      f"Saving vocabulary to {vocab_file}: vocabulary indices are not consecutive."
                      " Please check that the vocabulary is not corrupted!"
                  )
                  index = token_index
              writer.write(token + "\n")
              index += 1
      return (vocab_file,)
  
imports: import collections
  import os
  import sys
  import unicodedata
  from typing import Dict, List, Optional, Tuple, Union
  from ...tokenization_utils import AddedToken, PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
  from ...tokenization_utils_base import BatchEncoding, EncodedInput, PreTokenizedInput, TextInput, TextInputPair, TruncationStrategy
  from ...utils import PaddingStrategy, TensorType, add_end_docstrings, logging
label_desc: Use image node_id 12 for calling the LayoutLMv2Tokenizer obj's underlying member method code with example usage: obj.save_vocabulary(save_directory, filename_prefix) and returns: vocab_file