






import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ....tokenization_utils_fast import PreTrainedTokenizerFast
from ....utils import logging
from .tokenization_retribert import RetriBertTokenizer


_a    :   Optional[int]        =			logging.get_logger(__name__)

_a    :   List[Any]        =			{"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

_a    :   List[Any]        =			{
    """vocab_file""": {
        """yjernite/retribert-base-uncased""": (
            """https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/vocab.txt"""
        ),
    },
    """tokenizer_file""": {
        """yjernite/retribert-base-uncased""": (
            """https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/tokenizer.json"""
        ),
    },
}

_a    :   Dict        =			{
    """yjernite/retribert-base-uncased""": 512,
}


_a    :   Any        =			{
    """yjernite/retribert-base-uncased""": {"""do_lower_case""": True},
}







class 	_UpperCAmelCase  (  _A		):




      """simple docstring"""



      A          =    VOCAB_FILES_NAMES
      A          =    PRETRAINED_VOCAB_FILES_MAP
      A          =    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      A          =    PRETRAINED_INIT_CONFIGURATION
      A          =    RetriBertTokenizer
      A          =    ['''input_ids''', '''attention_mask''']
      def __init__(   self    ,	_lowerCAmelCase=None    ,	_lowerCAmelCase=None    ,	_lowerCAmelCase=True    ,	_lowerCAmelCase="[UNK]"    ,	_lowerCAmelCase="[SEP]"    ,	_lowerCAmelCase="[PAD]"    ,	_lowerCAmelCase="[CLS]"    ,	_lowerCAmelCase="[MASK]"    ,	_lowerCAmelCase=True    ,	_lowerCAmelCase=None    ,	**_lowerCAmelCase    ,	):



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

          lowerCAmelCase__   :Tuple      							=				json.loads(self.backend_tokenizer.normalizer.__getstate__()		)
          if (
              normalizer_state.get("lowercase"    ,	_lowerCAmelCase		) != do_lower_case
              or normalizer_state.get("strip_accents"    ,	_lowerCAmelCase		) != strip_accents
              or normalizer_state.get("handle_chinese_chars"    ,	_lowerCAmelCase		) != tokenize_chinese_chars
          ):
              lowerCAmelCase__   :Optional[int]      							=				getattr(_lowerCAmelCase    ,	normalizer_state.pop("type"		)		)
              lowerCAmelCase__   :Any      							=				do_lower_case
              lowerCAmelCase__   :int      							=				strip_accents
              lowerCAmelCase__   :List[str]      							=				tokenize_chinese_chars
              lowerCAmelCase__   :Optional[Any]      							=				normalizer_class(**_lowerCAmelCase		)

          lowerCAmelCase__   :str      							=				do_lower_case
      def 			snake_case_      (   self    ,	_lowerCAmelCase    ,	_lowerCAmelCase=None		):



          '''simple docstring'''
          lowerCAmelCase__   :int      							=				[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    ,	_lowerCAmelCase    ,	_lowerCAmelCase = None		):



          '''simple docstring'''
          lowerCAmelCase__   :Dict      							=				[self.sep_token_id]
          lowerCAmelCase__   :Dict      							=				[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    ,	_lowerCAmelCase    ,	_lowerCAmelCase = None		):



          '''simple docstring'''
          lowerCAmelCase__   :List[str]      							=				self._tokenizer.model.save(_lowerCAmelCase    ,	name=_lowerCAmelCase		)
          return tuple(_lowerCAmelCase		)











def 				snake_case__							(							UpperCAmelCase							:  str       ):
    return "".join(chr(ord(UpperCAmelCase       ) - 3_2       ) if "a" <= char <= "z" else char for char in word       )


if __name__ == "__main__":
 from doctest import testmod

 testmod()



