import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_convbert import ConvBertTokenizer


UpperCamelCase__    							= logging.get_logger(__name__)

UpperCamelCase__    							= {'vocab_file': 'vocab.txt'}

UpperCamelCase__    							= {
    'vocab_file': {
        'YituTech/conv-bert-base': 'https://huggingface.co/YituTech/conv-bert-base/resolve/main/vocab.txt',
        'YituTech/conv-bert-medium-small': (
            'https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/vocab.txt'
        ),
        'YituTech/conv-bert-small': 'https://huggingface.co/YituTech/conv-bert-small/resolve/main/vocab.txt',
    }
}

UpperCamelCase__    							= {
    'YituTech/conv-bert-base': 5_1_2,
    'YituTech/conv-bert-medium-small': 5_1_2,
    'YituTech/conv-bert-small': 5_1_2,
}


UpperCamelCase__    							= {
    'YituTech/conv-bert-base': {'do_lower_case': True},
    'YituTech/conv-bert-medium-small': {'do_lower_case': True},
    'YituTech/conv-bert-small': {'do_lower_case': True},
}





class 					A							(    UpperCAmelCase_					):
   __UpperCAmelCase			:			Dict              =      VOCAB_FILES_NAMES
   __UpperCAmelCase			:			List[str]              =      PRETRAINED_VOCAB_FILES_MAP
   __UpperCAmelCase			:			List[str]              =      PRETRAINED_INIT_CONFIGURATION
   __UpperCAmelCase			:			Optional[Any]              =      PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   __UpperCAmelCase			:			str              =      ConvBertTokenizer


   def __init__(self					:						Optional[Any]	,  __UpperCAmelCase					:						Tuple=None	,  __UpperCAmelCase					:						int=None	,  __UpperCAmelCase					:						str=True	,  __UpperCAmelCase					:						str="[UNK]"	,  __UpperCAmelCase					:						str="[SEP]"	,  __UpperCAmelCase					:						List[str]="[PAD]"	,  __UpperCAmelCase					:						List[str]="[CLS]"	,  __UpperCAmelCase					:						List[Any]="[MASK]"	,  __UpperCAmelCase					:						str=True	,  __UpperCAmelCase					:						Tuple=None	,  **__UpperCAmelCase					:						int	,  )						->    int:
         """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	,  )

         UpperCAmelCase__								=  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
         ):
               UpperCAmelCase__								=  getattr(__UpperCAmelCase	,  normalizer_state.pop("type"		)		)
               UpperCAmelCase__								=  do_lower_case
               UpperCAmelCase__								=  strip_accents
               UpperCAmelCase__								=  tokenize_chinese_chars
               UpperCAmelCase__								=  normalizer_class(**__UpperCAmelCase		)

         UpperCAmelCase__								=  do_lower_case


   def       lowercase_				(self					:						Optional[int]	,  __UpperCAmelCase					:						Union[str, Any]	,  __UpperCAmelCase					:						Optional[int]=None		)						->    Union[str, Any]:
         """simple docstring"""



         UpperCAmelCase__								=  [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       lowercase_				(self					:						int	,  __UpperCAmelCase					:						List[int]	,  __UpperCAmelCase					:						Optional[List[int]] = None		)						->    List[int]:
         """simple docstring"""



         UpperCAmelCase__								=  [self.sep_token_id]
         UpperCAmelCase__								=  [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[Any]	,  __UpperCAmelCase					:						str	,  __UpperCAmelCase					:						Optional[str] = None		)						->    Tuple[str]:
         """simple docstring"""



         UpperCAmelCase__								=  self._tokenizer.model.save(__UpperCAmelCase	,  name=__UpperCAmelCase		)
         return tuple(__UpperCAmelCase		)




def        lowerCAmelCase_			(					__A							)					->    str:







      '''simple docstring'''


      return " ".join(input_str.split()[::-1]							)


if __name__ == "__main__":
      import doctest

      doctest.testmod()



