




"""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_convbert import ConvBertTokenizer


a            =							logging.get_logger(__name__)

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

a            =							{
    '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',
    }
}

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


a            =							{
    '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 					SCREAMING_SNAKE_CASE__    (    _snake_case    ):
						_a			  =  VOCAB_FILES_NAMES
						_a			  =  PRETRAINED_VOCAB_FILES_MAP
						_a			  =  PRETRAINED_INIT_CONFIGURATION
						_a			  =  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
						_a			  =  ConvBertTokenizer


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

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

										lowerCAmelCase              = do_lower_case


						def      __lowercase       (							self :	Union[str, Any]  ,  lowerCAmelCase :	Dict  ,  lowerCAmelCase :	Union[str, Any]=None    ):
										lowerCAmelCase              = [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 :	Optional[Any]  ,  lowerCAmelCase :	Any  ,  lowerCAmelCase :	Any = None    ):
										lowerCAmelCase              = [self.sep_token_id]
										lowerCAmelCase              = [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 :	Optional[int]  ,  lowerCAmelCase :	Optional[int]  ,  lowerCAmelCase :	int = None    ):
										lowerCAmelCase              = self._tokenizer.model.save(_UpperCamelCase  ,  name=_UpperCamelCase    )
										return tuple(_UpperCamelCase    )













def      lowercase__      (     __snake_case    :							Dict  ):


					'''simple docstring'''


					if not head:
										return True
					# split the list to two parts
					UpperCAmelCase_       ,  UpperCAmelCase_    :      Any            =						head.next, head
					while fast and fast.next:
										UpperCAmelCase_    :      str            =						fast.next.next
										UpperCAmelCase_    :      Union[str, Any]            =						slow.next
					UpperCAmelCase_    :      int            =						slow.next
					UpperCAmelCase_    :      List[Any]            =						None  # Don't forget here! But forget still works!
					# reverse the second part
					UpperCAmelCase_    :      Tuple            =						None
					while second:
										UpperCAmelCase_    :      int            =						second.next
										UpperCAmelCase_    :      Any            =						node
										UpperCAmelCase_    :      Optional[Any]            =						second
										UpperCAmelCase_    :      Tuple            =						nxt
					# compare two parts
					# second part has the same or one less node
					while node:
										if node.val != head.val:
															return False
										UpperCAmelCase_    :      Optional[Any]            =						node.next
										UpperCAmelCase_    :      Dict            =						head.next
					return True




def      lowercase__      (     __snake_case    :							Union[str, Any]  ):


					'''simple docstring'''


					if not head or not head.next:
										return True

					# 1. Get the midpoint (slow)
					UpperCAmelCase_    :      Any            =						head
					while fast and fast.next:
										UpperCAmelCase_       ,  UpperCAmelCase_    :      Tuple            =						fast.next.next, slow.next

					# 2. Push the second half into the stack
					UpperCAmelCase_    :      List[str]            =						[slow.val]
					while slow.next:
										UpperCAmelCase_    :      List[str]            =						slow.next
										stack.append(slow.val  )

					# 3. Comparison
					while stack:
										if stack.pop() != cur.val:
															return False
										UpperCAmelCase_    :      int            =						cur.next

					return True






def      lowercase__      (     __snake_case    :							Dict  ):


					'''simple docstring'''


					if not head or not head.next:
										return True
					UpperCAmelCase_    :      Tuple            =						{}
					UpperCAmelCase_    :      int            =						0
					while head:
										if head.val in d:
															d[head.val].append(__snake_case  )
										else:
															UpperCAmelCase_    :      List[Any]            =						[pos]
										UpperCAmelCase_    :      Any            =						head.next
										pos += 1
					UpperCAmelCase_    :      Dict            =						pos - 1
					UpperCAmelCase_    :      Optional[int]            =						0
					for v in d.values():
										if len(__snake_case  ) % 2 != 0:
															middle += 1
										else:
															UpperCAmelCase_    :      int            =						0
															for i in range(0     ,       len(__snake_case  )  ):
																				if v[i] + v[len(__snake_case  ) - 1 - step] != checksum:
																									return False
																				step += 1
										if middle > 1:
															return False
					return True






