'''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:
 snake_case__					:      Dict				      =  None


snake_case__					:      Tuple				      =  logging.get_logger(__name__)

snake_case__					:      Optional[Any]				      =  {'''vocab_file''': '''spiece.model''', '''tokenizer_file''': '''tokenizer.json'''}

snake_case__					:      Any				      =  {
    '''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''',
    },
}

snake_case__					:      Optional[Any]				      =  {
    '''xlnet-base-cased''': None,
    '''xlnet-large-cased''': None,
}

snake_case__					:      List[Any]				      =  '''▁'''

# Segments (not really needed)
snake_case__					:      Tuple				      =  0
snake_case__					:      Optional[int]				      =  1
snake_case__					:      str				      =  2
snake_case__					:      List[Any]				      =  3
snake_case__					:      Dict				      =  4






class 					__SCREAMING_SNAKE_CASE						(	lowerCamelCase_	):







  '''simple docstring'''






  lowerCamelCase_		:Optional[Any]						   =		VOCAB_FILES_NAMES
  lowerCamelCase_		:Union[str, Any]						   =		PRETRAINED_VOCAB_FILES_MAP
  lowerCamelCase_		:Tuple						   =		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  lowerCamelCase_		:List[str]						   =		'''left'''
  lowerCamelCase_		:Optional[Any]						   =		XLNetTokenizer


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




       '''simple docstring'''

       UpperCAmelCase_							:       Dict       =				AddedToken(snake_case_				,		lstrip=snake_case_				,		rstrip=snake_case_						) if isinstance(snake_case_				,		snake_case_						) else mask_token

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

       UpperCAmelCase_							:       str       =				3
       UpperCAmelCase_							:       List[str]       =				do_lower_case
       UpperCAmelCase_							:       List[Any]       =				remove_space
       UpperCAmelCase_							:       Any       =				keep_accents
       UpperCAmelCase_							:       str       =				vocab_file
       UpperCAmelCase_							:       Tuple       =				False if not self.vocab_file else True


  def _UpperCamelCase					(			self				,		snake_case_				,		snake_case_ = None						):




       '''simple docstring'''

       UpperCAmelCase_							:       Union[str, Any]       =				[self.sep_token_id]
       UpperCAmelCase_							:       Union[str, Any]       =				[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 _UpperCamelCase					(			self				,		snake_case_				,		snake_case_ = None						):




       '''simple docstring'''

       UpperCAmelCase_							:       str       =				[self.sep_token_id]
       UpperCAmelCase_							:       int       =				[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 _UpperCamelCase					(			self				,		snake_case_				,		snake_case_ = 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(snake_case_						):
            logger.error(F'''Vocabulary path ({save_directory}) should be a directory'''						)
            return
       UpperCAmelCase_							:       List[Any]       =				os.path.join(
           snake_case_				,		(filename_prefix + '-' if filename_prefix else '') + VOCAB_FILES_NAMES['vocab_file']						)

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

       return (out_vocab_file,)







'''simple docstring'''


def  _lowerCamelCase   (				lowerCamelCase_ :							int     ,					lowerCamelCase_ :							int       ):



     """simple docstring"""





     return int(input_a == input_a == 0       )


def  _lowerCamelCase   (				):



     """simple docstring"""





     print('Truth Table of NOR Gate:'       )
     print('|   Input 1   |  Input 2  | Output |'       )
     print(F'''|      0      |    0      |  {nor_gate(0     ,					0       )}     |'''       )
     print(F'''|      0      |    1      |  {nor_gate(0     ,					1       )}     |'''       )
     print(F'''|      1      |    0      |  {nor_gate(1     ,					0       )}     |'''       )
     print(F'''|      1      |    1      |  {nor_gate(1     ,					1       )}     |'''       )


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 main()






