

'''simple docstring'''







import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_distilbert import DistilBertTokenizer


__lowerCamelCase						    =      logging.get_logger(__name__)

__lowerCamelCase						    =      {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

__lowerCamelCase						    =      {
    '''vocab_file''': {
        '''distilbert-base-uncased''': '''https://huggingface.co/distilbert-base-uncased/resolve/main/vocab.txt''',
        '''distilbert-base-uncased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/vocab.txt'''
        ),
        '''distilbert-base-cased''': '''https://huggingface.co/distilbert-base-cased/resolve/main/vocab.txt''',
        '''distilbert-base-cased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/vocab.txt'''
        ),
        '''distilbert-base-german-cased''': '''https://huggingface.co/distilbert-base-german-cased/resolve/main/vocab.txt''',
        '''distilbert-base-multilingual-cased''': (
            '''https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/vocab.txt'''
        ),
    },
    '''tokenizer_file''': {
        '''distilbert-base-uncased''': '''https://huggingface.co/distilbert-base-uncased/resolve/main/tokenizer.json''',
        '''distilbert-base-uncased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-cased''': '''https://huggingface.co/distilbert-base-cased/resolve/main/tokenizer.json''',
        '''distilbert-base-cased-distilled-squad''': (
            '''https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-german-cased''': (
            '''https://huggingface.co/distilbert-base-german-cased/resolve/main/tokenizer.json'''
        ),
        '''distilbert-base-multilingual-cased''': (
            '''https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/tokenizer.json'''
        ),
    },
}

__lowerCamelCase						    =      {
    '''distilbert-base-uncased''': 512,
    '''distilbert-base-uncased-distilled-squad''': 512,
    '''distilbert-base-cased''': 512,
    '''distilbert-base-cased-distilled-squad''': 512,
    '''distilbert-base-german-cased''': 512,
    '''distilbert-base-multilingual-cased''': 512,
}


__lowerCamelCase						    =      {
    '''distilbert-base-uncased''': {'''do_lower_case''': True},
    '''distilbert-base-uncased-distilled-squad''': {'''do_lower_case''': True},
    '''distilbert-base-cased''': {'''do_lower_case''': False},
    '''distilbert-base-cased-distilled-squad''': {'''do_lower_case''': False},
    '''distilbert-base-german-cased''': {'''do_lower_case''': False},
    '''distilbert-base-multilingual-cased''': {'''do_lower_case''': False},
}


class    A__ ( _snake_case     ):
    lowercase		   =						VOCAB_FILES_NAMES
    lowercase		   =						PRETRAINED_VOCAB_FILES_MAP
    lowercase		   =						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    lowercase		   =						PRETRAINED_INIT_CONFIGURATION
    lowercase		   =						["input_ids", "attention_mask"]
    lowercase		   =						DistilBertTokenizer



    def __init__(   self						,			UpperCamelCase__=None						,			UpperCamelCase__=None						,			UpperCamelCase__=True						,			UpperCamelCase__="[UNK]"						,			UpperCamelCase__="[SEP]"						,			UpperCamelCase__="[PAD]"						,			UpperCamelCase__="[CLS]"						,			UpperCamelCase__="[MASK]"						,			UpperCamelCase__=True						,			UpperCamelCase__=None						,			**UpperCamelCase__						,			)  -> Union[str, Any]:





           '''simple docstring'''
           super().__init__(
               UpperCamelCase__						,			tokenizer_file=UpperCamelCase__						,			do_lower_case=UpperCamelCase__						,			unk_token=UpperCamelCase__						,			sep_token=UpperCamelCase__						,			pad_token=UpperCamelCase__						,			cls_token=UpperCamelCase__						,			mask_token=UpperCamelCase__						,			tokenize_chinese_chars=UpperCamelCase__						,			strip_accents=UpperCamelCase__						,			**UpperCamelCase__						,			)

           A_		   = json.loads(self.backend_tokenizer.normalizer.__getstate__()    )
           if (
               normalizer_state.get("""lowercase"""						,			UpperCamelCase__    ) != do_lower_case
               or normalizer_state.get("""strip_accents"""						,			UpperCamelCase__    ) != strip_accents
               or normalizer_state.get("""handle_chinese_chars"""						,			UpperCamelCase__    ) != tokenize_chinese_chars
           ):
                  A_		   = getattr(UpperCamelCase__						,			normalizer_state.pop("""type"""    )    )
                  A_		   = do_lower_case
                  A_		   = strip_accents
                  A_		   = tokenize_chinese_chars
                  A_		   = normalizer_class(**UpperCamelCase__    )

           A_		   = do_lower_case



    def    snake_case_     (   self						,			UpperCamelCase__						,			UpperCamelCase__=None    )  -> List[Any]:





           '''simple docstring'''
           A_		   = [self.cls_token_id] + token_ids_a + [self.sep_token_id]

           if token_ids_a:
                  output += token_ids_a + [self.sep_token_id]

           return output



    def    snake_case_     (   self						,			UpperCamelCase__						,			UpperCamelCase__ = None    )  -> int:





           '''simple docstring'''
           A_		   = [self.sep_token_id]
           A_		   = [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    snake_case_     (   self						,			UpperCamelCase__						,			UpperCamelCase__ = None    )  -> Optional[Any]:





           '''simple docstring'''
           A_		   = self._tokenizer.model.save(UpperCamelCase__						,			name=UpperCamelCase__    )
           return tuple(UpperCamelCase__    )








'''simple docstring'''







def  UpperCAmelCase__      ( UpperCAmelCase__,    UpperCAmelCase__			)     ->     bool:
       A_		   = len(UpperCAmelCase__			)
       A_		   = [[False] * (required_sum + 1) for _ in range(arr_len + 1			)]

       # for each arr value, a sum of zero(0) can be formed by not taking any element
       # hence True/1
       for i in range(arr_len + 1			):
              A_		   = True

       # sum is not zero and set is empty then false
       for i in range(1,    required_sum + 1			):
              A_		   = False

       for i in range(1,    arr_len + 1			):
              for j in range(1,    required_sum + 1			):
                     if arr[i - 1] > j:
                            A_		   = subset[i - 1][j]
                     if arr[i - 1] <= j:
                            A_		   = subset[i - 1][j] or subset[i - 1][j - arr[i - 1]]

       return subset[arr_len][required_sum]


if __name__ == "__main__":
      import doctest

      doctest.testmod()
