class_docstr: Construct a Flaubert tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:
  
  - Moses preprocessing and tokenization.
  - Normalizing all inputs text.
  - The arguments `special_tokens` and the function `set_special_tokens`, can be used to add additional symbols (like
    "__classify__") to a vocabulary.
  - The argument `do_lowercase` controls lower casing (automatically set for pretrained vocabularies).
  
  This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
  this superclass for more information regarding those methods.
  
  Args:
      vocab_file (`str`):
          Vocabulary file.
      merges_file (`str`):
          Merges file.
      do_lowercase (`bool`, *optional*, defaults to `False`):
          Controls lower casing.
      unk_token (`str`, *optional*, defaults to `"<unk>"`):
          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 `"<s>"`):
          The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.
  
          <Tip>
  
          When building a sequence using special tokens, this is not the token that is used for the beginning of
          sequence. The token used is the `cls_token`.
  
          </Tip>
  
      sep_token (`str`, *optional*, defaults to `"</s>"`):
          The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
          sequence classification or for a text and a question for question answering. It is also used as the last
          token of a sequence built with special tokens.
      pad_token (`str`, *optional*, defaults to `"<pad>"`):
          The token used for padding, for example when batching sequences of different lengths.
      cls_token (`str`, *optional*, defaults to `"</s>"`):
          The classifier token which is used when doing sequence classification (classification of the whole sequence
          instead of per-token classification). It is the first token of the sequence when built with special tokens.
      mask_token (`str`, *optional*, defaults to `"<special1>"`):
          The token used for masking values. This is the token used when training this model with masked language
          modeling. This is the token which the model will try to predict.
      additional_special_tokens (`List[str]`, *optional*, defaults to `["<special0>","<special1>","<special2>","<special3>","<special4>","<special5>","<special6>","<special7>","<special8>","<special9>"]`):
          List of additional special tokens.
      lang2id (`Dict[str, int]`, *optional*):
          Dictionary mapping languages string identifiers to their IDs.
      id2lang (`Dict[int, str]`, *optional*):
          Dictionary mapping language IDs to their string identifiers.
class_docstr_tok: ["Construct","a","Flaubert","tokenizer",".","Based","on","Byte-Pair","Encoding",".","The","tokenization","process","is","the","following",":","-","Moses","preprocessing","and","tokenization",".","-","Normalizing","all","inputs","text",".","-","The","arguments","`","special_tokens","`","and","the","function","`","set_special_tokens","`",",","can","be","used","to","add","additional","symbols","(","like","``","__classify__","''",")","to","a","vocabulary",".","-","The","argument","`","do_lowercase","`","controls","lower","casing","(","automatically","set","for","pretrained","vocabularies",")",".","This","tokenizer","inherits","from","[","`","PreTrainedTokenizer","`","]","which","contains","most","of","the","main","methods",".","Users","should","refer","to","this","superclass","for","more","information","regarding","those","methods",".","Args",":","vocab_file","(","`","str","`",")",":","Vocabulary","file",".","merges_file","(","`","str","`",")",":","Merges","file",".","do_lowercase","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Controls","lower","casing",".","unk_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","unk",">","''","`",")",":","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","`","``","<","s",">","''","`",")",":","The","beginning","of","sequence","token","that","was","used","during","pretraining",".","Can","be","used","a","sequence","classifier","token",".","<","Tip",">","When","building","a","sequence","using","special","tokens",",","this","is","not","the","token","that","is","used","for","the","beginning","of","sequence",".","The","token","used","is","the","`","cls_token","`",".","<","\/Tip",">","sep_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","\/s",">","''","`",")",":","The","separator","token",",","which","is","used","when","building","a","sequence","from","multiple","sequences",",","e.g",".","two","sequences","for","sequence","classification","or","for","a","text","and","a","question","for","question","answering",".","It","is","also","used","as","the","last","token","of","a","sequence","built","with","special","tokens",".","pad_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","pad",">","''","`",")",":","The","token","used","for","padding",",","for","example","when","batching","sequences","of","different","lengths",".","cls_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","\/s",">","''","`",")",":","The","classifier","token","which","is","used","when","doing","sequence","classification","(","classification","of","the","whole","sequence","instead","of","per-token","classification",")",".","It","is","the","first","token","of","the","sequence","when","built","with","special","tokens",".","mask_token","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","<","special1",">","''","`",")",":","The","token","used","for","masking","values",".","This","is","the","token","used","when","training","this","model","with","masked","language","modeling",".","This","is","the","token","which","the","model","will","try","to","predict",".","additional_special_tokens","(","`","List","[","str","]","`",",","*","optional","*",",","defaults","to","`","[","``","<","special0",">","''",",","''","<","special1",">","''",",","''","<","special2",">","''",",","''","<","special3",">","''",",","''","<","special4",">","''",",","''","<","special5",">","''",",","''","<","special6",">","''",",","''","<","special7",">","''",",","''","<","special8",">","''",",","''","<","special9",">","''","]","`",")",":","List","of","additional","special","tokens",".","lang2id","(","`","Dict","[","str",",","int","]","`",",","*","optional","*",")",":","Dictionary","mapping","languages","string","identifiers","to","their","IDs",".","id2lang","(","`","Dict","[","int",",","str","]","`",",","*","optional","*",")",":","Dictionary","mapping","language","IDs","to","their","string","identifiers","."]
code: def __init__(
      self,
      vocab_file,
      merges_file,
      do_lowercase=False,
      unk_token="<unk>",
      bos_token="<s>",
      sep_token="</s>",
      pad_token="<pad>",
      cls_token="</s>",
      mask_token="<special1>",
      additional_special_tokens=[
          "<special0>",
          "<special1>",
          "<special2>",
          "<special3>",
          "<special4>",
          "<special5>",
          "<special6>",
          "<special7>",
          "<special8>",
          "<special9>",
      ],
      lang2id=None,
      id2lang=None,
      **kwargs,
  ):
      do_lowercase_and_remove_accent = kwargs.pop(
          "do_lowercase_and_remove_accent", None
      )
      if do_lowercase_and_remove_accent is not None:
          logger.warning(
              "`do_lowercase_and_remove_accent` is passed as a keyword argument, but this won't do anything."
              " `FlaubertTokenizer` will always set it to `False`."
          )
      # always `False`
      self.do_lowercase_and_remove_accent = False
  
      self.do_lowercase = do_lowercase
  
      super().__init__(
          unk_token=unk_token,
          bos_token=bos_token,
          sep_token=sep_token,
          pad_token=pad_token,
          cls_token=cls_token,
          mask_token=mask_token,
          additional_special_tokens=additional_special_tokens,
          lang2id=lang2id,
          id2lang=id2lang,
          **kwargs,
      )
  
      try:
          import sacremoses
      except ImportError:
          raise ImportError(
              "You need to install sacremoses to use FlaubertTokenizer. "
              "See https://pypi.org/project/sacremoses/ for installation."
          )
  
      self.sm = sacremoses
  
      # cache of sm.MosesPunctNormalizer instance
      self.cache_moses_punct_normalizer = dict()
      # cache of sm.MosesTokenizer instance
      self.cache_moses_tokenizer = dict()
      self.lang_with_custom_tokenizer = set(["zh", "th", "ja"])
      self.lang2id = lang2id
      self.id2lang = id2lang
      if lang2id is not None and id2lang is not None:
          assert len(lang2id) == len(id2lang)
  
      self.ja_word_tokenizer = None
      self.zh_word_tokenizer = None
  
      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()}
      with open(merges_file, encoding="utf-8") as merges_handle:
          merges = merges_handle.read().split("\n")[:-1]
      merges = [tuple(merge.split()[:2]) for merge in merges]
      self.bpe_ranks = dict(zip(merges, range(len(merges))))
      self.cache = {}
  
imports: import json
  import os
  import re
  import unicodedata
  from typing import List, Optional, Tuple
  from ...tokenization_utils import PreTrainedTokenizer
  from ...utils import logging
label_desc: Use image node_id 1 to create a new FlaubertTokenizer object from inherited base classes: PreTrainedTokenizer with example: obj = FlaubertTokenizer(vocab_file, merges_file, do_lowercase, unk_token, bos_token, sep_token, pad_token, cls_token, mask_token, additional_special_tokens, lang2id, id2lang)