





'''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_albert import AlbertTokenizer
else:
 lowerCAmelCase					:     List[str]												=None

lowerCAmelCase					:     Tuple												=logging.get_logger(__name__)
lowerCAmelCase					:     Optional[int]												={'''vocab_file''': '''spiece.model''', '''tokenizer_file''': '''tokenizer.json'''}

lowerCAmelCase					:     Dict												={
    '''vocab_file''': {
        '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/spiece.model''',
        '''albert-large-v1''': '''https://huggingface.co/albert-large-v1/resolve/main/spiece.model''',
        '''albert-xlarge-v1''': '''https://huggingface.co/albert-xlarge-v1/resolve/main/spiece.model''',
        '''albert-xxlarge-v1''': '''https://huggingface.co/albert-xxlarge-v1/resolve/main/spiece.model''',
        '''albert-base-v2''': '''https://huggingface.co/albert-base-v2/resolve/main/spiece.model''',
        '''albert-large-v2''': '''https://huggingface.co/albert-large-v2/resolve/main/spiece.model''',
        '''albert-xlarge-v2''': '''https://huggingface.co/albert-xlarge-v2/resolve/main/spiece.model''',
        '''albert-xxlarge-v2''': '''https://huggingface.co/albert-xxlarge-v2/resolve/main/spiece.model''',
    },
    '''tokenizer_file''': {
        '''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/tokenizer.json''',
        '''albert-large-v1''': '''https://huggingface.co/albert-large-v1/resolve/main/tokenizer.json''',
        '''albert-xlarge-v1''': '''https://huggingface.co/albert-xlarge-v1/resolve/main/tokenizer.json''',
        '''albert-xxlarge-v1''': '''https://huggingface.co/albert-xxlarge-v1/resolve/main/tokenizer.json''',
        '''albert-base-v2''': '''https://huggingface.co/albert-base-v2/resolve/main/tokenizer.json''',
        '''albert-large-v2''': '''https://huggingface.co/albert-large-v2/resolve/main/tokenizer.json''',
        '''albert-xlarge-v2''': '''https://huggingface.co/albert-xlarge-v2/resolve/main/tokenizer.json''',
        '''albert-xxlarge-v2''': '''https://huggingface.co/albert-xxlarge-v2/resolve/main/tokenizer.json''',
    },
}

lowerCAmelCase					:     List[str]												={
    '''albert-base-v1''': 512,
    '''albert-large-v1''': 512,
    '''albert-xlarge-v1''': 512,
    '''albert-xxlarge-v1''': 512,
    '''albert-base-v2''': 512,
    '''albert-large-v2''': 512,
    '''albert-xlarge-v2''': 512,
    '''albert-xxlarge-v2''': 512,
}

lowerCAmelCase					:     Optional[Any]												='''▁'''
class       a_   (				_lowerCAmelCase							):
     __A      =			VOCAB_FILES_NAMES
     __A      =			PRETRAINED_VOCAB_FILES_MAP
     __A      =			PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     __A      =			AlbertTokenizer





     def __init__( self		:					Union[str, Any]	,      lowercase		:					int=None	,      lowercase		:					Dict=None	,      lowercase		:					Tuple=True	,      lowercase		:					Optional[int]=True	,      lowercase		:					List[Any]=False	,      lowercase		:					Optional[int]="[CLS]"	,      lowercase		:					List[str]="[SEP]"	,      lowercase		:					Optional[int]="<unk>"	,      lowercase		:					Optional[int]="[SEP]"	,      lowercase		:					Optional[int]="<pad>"	,      lowercase		:					Dict="[CLS]"	,      lowercase		:					List[str]="[MASK]"	,      **lowercase		:					str	,      ):





        """simple docstring"""




        lowercase_			:Dict    			= (
            AddedToken(lowercase	,      lstrip=lowercase	,      rstrip=lowercase	,      normalized=lowercase						)
            if isinstance(lowercase	,      lowercase						)
            else mask_token
        )

        super().__init__(
            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	,      **lowercase	,      )

        lowercase_			:int    			= do_lower_case
        lowercase_			:Union[str, Any]    			= remove_space
        lowercase_			:Any    			= keep_accents
        lowercase_			:List[str]    			= vocab_file
        lowercase_			:Any    			= False if not self.vocab_file else True





     def 							lowercase__      ( self		:					List[str]	,      lowercase		:					List[int]	,      lowercase		:					Optional[List[int]] = None						):





        """simple docstring"""




        lowercase_			:int    			= [self.sep_token_id]
        lowercase_			:List[str]    			= [self.cls_token_id]
        if token_ids_a is None:
           return cls + token_ids_a + sep
        return cls + token_ids_a + sep + token_ids_a + sep





     def 							lowercase__      ( self		:					Tuple	,      lowercase		:					List[int]	,      lowercase		:					Optional[List[int]] = None						):





        """simple docstring"""




        lowercase_			:Tuple    			= [self.sep_token_id]
        lowercase_			:List[str]    			= [self.cls_token_id]

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







     def 							lowercase__      ( self		:					List[str]	,      lowercase		:					str	,      lowercase		:					Optional[str] = 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
        lowercase_			:Union[str, Any]    			= 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,)









'''simple docstring'''


def 							UpperCAmelCase_  (						__lowerCamelCase					:					int	,__lowerCamelCase					:					int ):
   return int((input_a, input_a).count(0 ) == 0 )
def 							UpperCAmelCase_  (						):
   assert and_gate(0	,0 ) == 0
   assert and_gate(0	,1 ) == 0
   assert and_gate(1	,0 ) == 0
   assert and_gate(1	,1 ) == 1


if __name__ == "__main__":
 test_and_gate()
 print(and_gate(1, 0))
 print(and_gate(0, 0))
 print(and_gate(0, 1))
 print(and_gate(1, 1))


