class_docstr: Construct an XLM tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:
  
  - Moses preprocessing and tokenization for most supported languages.
  - Language specific tokenization for Chinese (Jieba), Japanese (KyTea) and Thai (PyThaiNLP).
  - Optionally lowercases and normalizes 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 `lang2id` attribute maps the languages supported by the model with their IDs if provided (automatically set
    for pretrained vocabularies).
  - The `id2lang` attributes does reverse mapping if provided (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.
      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.
      do_lowercase_and_remove_accent (`bool`, *optional*, defaults to `True`):
          Whether to lowercase and remove accents when tokenizing.
class_docstr_tok: ["Construct","an","XLM","tokenizer",".","Based","on","Byte-Pair","Encoding",".","The","tokenization","process","is","the","following",":","-","Moses","preprocessing","and","tokenization","for","most","supported","languages",".","-","Language","specific","tokenization","for","Chinese","(","Jieba",")",",","Japanese","(","KyTea",")","and","Thai","(","PyThaiNLP",")",".","-","Optionally","lowercases","and","normalizes","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","`","lang2id","`","attribute","maps","the","languages","supported","by","the","model","with","their","IDs","if","provided","(","automatically","set","for","pretrained","vocabularies",")",".","-","The","`","id2lang","`","attributes","does","reverse","mapping","if","provided","(","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",".","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",".","do_lowercase_and_remove_accent","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","lowercase","and","remove","accents","when","tokenizing","."]
docstr: Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
  special tokens using the tokenizer `prepare_for_model` method.
  
  Args:
      token_ids_0 (`List[int]`):
          List of IDs.
      token_ids_1 (`List[int]`, *optional*):
          Optional second list of IDs for sequence pairs.
      already_has_special_tokens (`bool`, *optional*, defaults to `False`):
          Whether or not the token list is already formatted with special tokens for the model.
  
  Returns:
      `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
docstr_tok: ["Retrieve","sequence","ids","from","a","token","list","that","has","no","special","tokens","added",".","This","method","is","called","when","adding","special","tokens","using","the","tokenizer","`","prepare_for_model","`","method",".","Args",":","token_ids_0","(","`","List","[","int","]","`",")",":","List","of","IDs",".","token_ids_1","(","`","List","[","int","]","`",",","*","optional","*",")",":","Optional","second","list","of","IDs","for","sequence","pairs",".","already_has_special_tokens","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","the","token","list","is","already","formatted","with","special","tokens","for","the","model",".","Returns",":","`","List","[","int","]","`",":","A","list","of","integers","in","the","range","[","0",",","1","]",":","1","for","a","special","token",",","0","for","a","sequence","token","."]
code: def get_special_tokens_mask(
      self,
      token_ids_0: List[int],
      token_ids_1: Optional[List[int]] = None,
      already_has_special_tokens: bool = False,
  ) -> List[int]:
      """
      Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
      special tokens using the tokenizer `prepare_for_model` method.
  
      Args:
          token_ids_0 (`List[int]`):
              List of IDs.
          token_ids_1 (`List[int]`, *optional*):
              Optional second list of IDs for sequence pairs.
          already_has_special_tokens (`bool`, *optional*, defaults to `False`):
              Whether or not the token list is already formatted with special tokens for the model.
  
      Returns:
          `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
      """
  
      if already_has_special_tokens:
          return super().get_special_tokens_mask(
              token_ids_0=token_ids_0,
              token_ids_1=token_ids_1,
              already_has_special_tokens=True,
          )
  
      if token_ids_1 is not None:
          return (
              [1]
              + ([0] * len(token_ids_0))
              + [1]
              + ([0] * len(token_ids_1))
              + [1]
          )
      return [1] + ([0] * len(token_ids_0)) + [1]
  
imports: import json
  import os
  import re
  import sys
  import unicodedata
  from typing import List, Optional, Tuple
  from ...tokenization_utils import PreTrainedTokenizer
  from ...utils import logging
label_desc: Use image node_id 15 for calling the XLMTokenizer obj's underlying member method code with example usage: obj.get_special_tokens_mask(token_ids_0, token_ids_1, already_has_special_tokens) and returns: unknown, super, unknown