
'''simple docstring'''



import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
						from .tokenization_xlnet import XLNetTokenizer
else:
						_lowercase          =						None


_lowercase          =						logging.get_logger(__name__)

_lowercase          =						{"""vocab_file""": """spiece.model""", """tokenizer_file""": """tokenizer.json"""}

_lowercase          =						{
    """vocab_file""": {
        """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/spiece.model""",
        """xlnet-large-cased""": """https://huggingface.co/xlnet-large-cased/resolve/main/spiece.model""",
    },
    """tokenizer_file""": {
        """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/tokenizer.json""",
        """xlnet-large-cased""": """https://huggingface.co/xlnet-large-cased/resolve/main/tokenizer.json""",
    },
}

_lowercase          =						{
    """xlnet-base-cased""": None,
    """xlnet-large-cased""": None,
}

_lowercase          =						"""▁"""

# Segments (not really needed)
_lowercase          =						0
_lowercase          =						1
_lowercase          =						2
_lowercase          =						3
_lowercase          =						4




class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: str										=  VOCAB_FILES_NAMES
						_lowercase						: Optional[int]										=  PRETRAINED_VOCAB_FILES_MAP
						_lowercase						: Optional[Any]										=  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
						_lowercase						: str										=  '''left'''
						_lowercase						: Optional[int]										=  XLNetTokenizer




						def __init__(   self       ,  _lowercase=None       ,  _lowercase=None       ,  _lowercase=False       ,  _lowercase=True       ,  _lowercase=False       ,  _lowercase="<s>"       ,  _lowercase="</s>"       ,  _lowercase="<unk>"       ,  _lowercase="<sep>"       ,  _lowercase="<pad>"       ,  _lowercase="<cls>"       ,  _lowercase="<mask>"       ,  _lowercase=["<eop>", "<eod>"]       ,  **_lowercase       ,  ):

												"""simple docstring"""



												_lowerCAmelCase    		=					AddedToken(_lowercase       ,  lstrip=_lowercase       ,  rstrip=_lowercase ) if isinstance(_lowercase       ,  _lowercase ) else mask_token

												super().__init__(
												    vocab_file=_lowercase       ,  tokenizer_file=_lowercase       ,  do_lower_case=_lowercase       ,  remove_space=_lowercase       ,  keep_accents=_lowercase       ,  bos_token=_lowercase       ,  eos_token=_lowercase       ,  unk_token=_lowercase       ,  sep_token=_lowercase       ,  pad_token=_lowercase       ,  cls_token=_lowercase       ,  mask_token=_lowercase       ,  additional_special_tokens=_lowercase       ,  **_lowercase       ,  )

												_lowerCAmelCase    		=					3
												_lowerCAmelCase    		=					do_lower_case
												_lowerCAmelCase    		=					remove_space
												_lowerCAmelCase    		=					keep_accents
												_lowerCAmelCase    		=					vocab_file
												_lowerCAmelCase    		=					False if not self.vocab_file else True




						def    _lowercase      (   self       ,  _lowercase       ,  _lowercase = None ):

												"""simple docstring"""



												_lowerCAmelCase    		=					[self.sep_token_id]
												_lowerCAmelCase    		=					[self.cls_token_id]
												if token_ids_a is None:
																		return token_ids_a + sep + cls
												return token_ids_a + sep + token_ids_a + sep + cls




						def    _lowercase      (   self       ,  _lowercase       ,  _lowercase = None ):

												"""simple docstring"""



												_lowerCAmelCase    		=					[self.sep_token_id]
												_lowerCAmelCase    		=					[2]

												if token_ids_a is None:
																		return len(token_ids_a + sep ) * [0] + cls_segment_id
												return len(token_ids_a + sep ) * [0] + len(token_ids_a + sep ) * [1] + cls_segment_id




						def    _lowercase      (   self       ,  _lowercase       ,  _lowercase = None ):

												"""simple docstring"""



												if not self.can_save_slow_tokenizer:
																		raise ValueError(
																		    """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
																		    """tokenizer.""" )

												if not os.path.isdir(_lowercase ):
																		logger.error(F'Vocabulary path ({save_directory}) should be a directory' )
																		return
												_lowerCAmelCase    		=					os.path.join(
												    _lowercase       ,  (filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""] )

												if os.path.abspath(self.vocab_file ) != os.path.abspath(_lowercase ):
																		copyfile(self.vocab_file       ,  _lowercase )

												return (out_vocab_file,)







def      A__       (    SCREAMING_SNAKE_CASE_   :      int						)  ->  bool:






   """simple docstring"""







   if not isinstance(SCREAMING_SNAKE_CASE_				,	SCREAMING_SNAKE_CASE_						):
      _UpperCAmelCase           =   F'''Input value of [number={number}] must be an integer'''
      raise TypeError(SCREAMING_SNAKE_CASE_						)
   if number < 0:
      return False
   _UpperCAmelCase           =   number * number
   while number > 0:
      if number % 10 != number_square % 10:
         return False
      number //= 10
      number_square //= 10
   return True


if __name__ == "__main__":
   import doctest

   doctest.testmod()