class_docstr: Construct an Whisper tokenizer.
  
  This tokenizer inherits from [`PreTrainedTokenizer`] which contains some of the main methods. Users should refer to
  the superclass for more information regarding such methods.
  
   Args:
      vocab_file (`str`):
          Path to the vocabulary file.
      merges_file (`str`):
          Path to the merges file.
      normalizer_file (`str`, *optional*, defaults to `None`):
          Path to the normalizer_file file.
      errors (`str`, *optional*, defaults to `"replace"`):
          Paradigm to follow when decoding bytes to UTF-8. See
          [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
      unk_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
          The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
          token instead.
      bos_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
          The beginning of sequence token.
      eos_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
          The end of sequence token.
      add_prefix_space (`bool`, *optional*, defaults to `False`):
          Whether or not to add an initial space to the input. This allows to treat the leading word just as any
          other word.
      add_bos_token (`bool`, *optional*, defaults to `False`):
          Whether or not to add an initial <|endoftext|> to the input. This allows to treat the leading word just as
          any other word.
class_docstr_tok: ["Construct","an","Whisper","tokenizer",".","This","tokenizer","inherits","from","[","`","PreTrainedTokenizer","`","]","which","contains","some","of","the","main","methods",".","Users","should","refer","to","the","superclass","for","more","information","regarding","such","methods",".","Args",":","vocab_file","(","`","str","`",")",":","Path","to","the","vocabulary","file",".","merges_file","(","`","str","`",")",":","Path","to","the","merges","file",".","normalizer_file","(","`","str","`",",","*","optional","*",",","defaults","to","`","None","`",")",":","Path","to","the","normalizer_file","file",".","errors","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","replace","''","`",")",":","Paradigm","to","follow","when","decoding","bytes","to","UTF-8",".","See","[","bytes.decode","]","(","https",":","\/\/docs.python.org\/3\/library\/stdtypes.html","#","bytes.decode",")","for","more","information",".","unk_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","|endoftext|",">","''","`",")",":","The","unknown","token",".","A","token","that","is","not","in","the","vocabulary","can","not","be","converted","to","an","ID","and","is","set","to","be","this","token","instead",".","bos_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","|endoftext|",">","''","`",")",":","The","beginning","of","sequence","token",".","eos_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","|endoftext|",">","''","`",")",":","The","end","of","sequence","token",".","add_prefix_space","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","to","add","an","initial","space","to","the","input",".","This","allows","to","treat","the","leading","word","just","as","any","other","word",".","add_bos_token","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","to","add","an","initial","<","|endoftext|",">","to","the","input",".","This","allows","to","treat","the","leading","word","just","as","any","other","word","."]
code: def __init__(
      self,
      vocab_file,
      merges_file,
      normalizer_file=None,
      errors="replace",
      unk_token="<|endoftext|>",
      bos_token="<|endoftext|>",
      eos_token="<|endoftext|>",
      pad_token=None,
      add_prefix_space=False,
      add_bos_token=False,
      **kwargs,
  ):
      bos_token = (
          AddedToken(bos_token, lstrip=False, rstrip=False)
          if isinstance(bos_token, str)
          else bos_token
      )
      eos_token = (
          AddedToken(eos_token, lstrip=False, rstrip=False)
          if isinstance(eos_token, str)
          else eos_token
      )
      unk_token = (
          AddedToken(unk_token, lstrip=False, rstrip=False)
          if isinstance(unk_token, str)
          else unk_token
      )
      pad_token = (
          AddedToken(pad_token, lstrip=False, rstrip=False)
          if isinstance(pad_token, str)
          else pad_token
      )
      super().__init__(
          errors=errors,
          unk_token=unk_token,
          bos_token=bos_token,
          eos_token=eos_token,
          pad_token=pad_token,
          add_prefix_space=add_prefix_space,
          add_bos_token=add_bos_token,
          **kwargs,
      )
      self.add_bos_token = add_bos_token
  
      with open(vocab_file, encoding="utf-8") as vocab_handle:
          self.encoder = json.load(vocab_handle)
      self.decoder = {v: k for k, v in self.encoder.items()}
      self.errors = errors  # how to handle errors in decoding
      self.byte_encoder = bytes_to_unicode()
      self.byte_decoder = {v: k for k, v in self.byte_encoder.items()}
      with open(merges_file, encoding="utf-8") as merges_handle:
          bpe_merges = merges_handle.read().split("\n")[1:-1]
      bpe_merges = [tuple(merge.split()) for merge in bpe_merges]
      self.bpe_ranks = dict(zip(bpe_merges, range(len(bpe_merges))))
      self.cache = {}
      self.add_prefix_space = add_prefix_space
  
      if normalizer_file is not None:
          with open(normalizer_file, encoding="utf-8") as vocab_handle:
              self.english_spelling_normalizer = json.load(vocab_handle)
      else:
          self.english_spelling_normalizer = None
  
      # Should have added re.IGNORECASE so BPE merges can happen for capitalized versions of contractions
      self.pat = re.compile(
          r"""'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+"""
      )
  
imports: import json
  import os
  from typing import List, Optional, Tuple, Union
  import regex
  from ...tokenization_utils import AddedToken, PreTrainedTokenizer
  from ...utils import logging
  from .english_normalizer import EnglishTextNormalizer
label_desc: Use image node_id 1 to create a new WhisperTokenizer object from inherited base classes: PreTrainedTokenizer with example: obj = WhisperTokenizer(vocab_file, merges_file, normalizer_file, errors, unk_token, bos_token, eos_token, pad_token, add_prefix_space, add_bos_token)