






"""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


_UpperCamelCase		:  str						=		logging.get_logger(__name__)

_UpperCamelCase		:  Optional[Any]						=		{'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

_UpperCamelCase		:  List[str]						=		{
    '''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'''
        ),
    },
}

_UpperCamelCase		:  Optional[int]						=		{
    '''distilbert-base-uncased''': 5_1_2,
    '''distilbert-base-uncased-distilled-squad''': 5_1_2,
    '''distilbert-base-cased''': 5_1_2,
    '''distilbert-base-cased-distilled-squad''': 5_1_2,
    '''distilbert-base-german-cased''': 5_1_2,
    '''distilbert-base-multilingual-cased''': 5_1_2,
}


_UpperCamelCase		:  Tuple						=		{
    '''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     (   lowerCAmelCase__	):
    UpperCAmelCase_ :     List[str]	     =VOCAB_FILES_NAMES
    UpperCAmelCase_ :     List[str]	     =PRETRAINED_VOCAB_FILES_MAP
    UpperCAmelCase_ :     str	     =PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    UpperCAmelCase_ :     Optional[int]	     =PRETRAINED_INIT_CONFIGURATION
    UpperCAmelCase_ :     List[str]	     =["""input_ids""", """attention_mask"""]
    UpperCAmelCase_ :     Dict	     =DistilBertTokenizer







    def __init__(			self							,		_lowerCamelCase=None							,		_lowerCamelCase=None							,		_lowerCamelCase=True							,		_lowerCamelCase="[UNK]"							,		_lowerCamelCase="[SEP]"							,		_lowerCamelCase="[PAD]"							,		_lowerCamelCase="[CLS]"							,		_lowerCamelCase="[MASK]"							,		_lowerCamelCase=True							,		_lowerCamelCase=None							,		**_lowerCamelCase							,		):
      super().__init__(
          lowercase_							,		tokenizer_file=lowercase_							,		do_lower_case=lowercase_							,		unk_token=lowercase_							,		sep_token=lowercase_							,		pad_token=lowercase_							,		cls_token=lowercase_							,		mask_token=lowercase_							,		tokenize_chinese_chars=lowercase_							,		strip_accents=lowercase_							,		**lowercase_							,		)

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

      lowercase							    =       do_lower_case







    def 			UpperCamelCase_      (			self							,		_lowerCamelCase							,		_lowerCamelCase=None       ):
      lowercase							    =       [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 			UpperCamelCase_      (			self							,		_lowerCamelCase							,		_lowerCamelCase = None       ):
      lowercase							    =       [self.sep_token_id]
      lowercase							    =       [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 			UpperCamelCase_      (			self							,		_lowerCamelCase							,		_lowerCamelCase = None       ):
      lowercase							    =       self._tokenizer.model.save(lowercase_							,		name=lowercase_       )
      return tuple(lowercase_       )







"""simple docstring"""

from functools import lru_cache




@lru_cache
def __lowercase			(							_a    ):
    if num < 0:
        raise ValueError('''Number should not be negative.'''    )

    return 1 if num in (0, 1) else num * factorial(num - 1    )


if __name__ == "__main__":
     import doctest

     doctest.testmod()





