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


lowerCamelCase__   					=		logging.get_logger(__name__)

lowerCamelCase__   					=		{"""vocab_file""": """vocab.txt"""}

lowerCamelCase__   					=		{
    """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""",
    }
}

lowerCamelCase__   					=		{
    """YituTech/conv-bert-base""": 512,
    """YituTech/conv-bert-medium-small""": 512,
    """YituTech/conv-bert-small""": 512,
}


lowerCamelCase__   					=		{
    """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):
		A_						:       Tuple				   =	VOCAB_FILES_NAMES
		A_						:       Optional[Any]				   =	PRETRAINED_VOCAB_FILES_MAP
		A_						:       Tuple				   =	PRETRAINED_INIT_CONFIGURATION
		A_						:       str				   =	PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
		A_						:       List[Any]				   =	ConvBertTokenizer

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

			__lowerCAmelCase			:						int									=      json.loads(self.backend_tokenizer.normalizer.__getstate__() )
			if (
			    normalizer_state.get('lowercase'       ,		_SCREAMING_SNAKE_CASE ) != do_lower_case
			    or normalizer_state.get('strip_accents'       ,		_SCREAMING_SNAKE_CASE ) != strip_accents
			    or normalizer_state.get('handle_chinese_chars'       ,		_SCREAMING_SNAKE_CASE ) != tokenize_chinese_chars
			):
				__lowerCAmelCase			:						Union[str, Any]									=      getattr(_SCREAMING_SNAKE_CASE       ,		normalizer_state.pop('type' ) )
				__lowerCAmelCase			:						Dict									=      do_lower_case
				__lowerCAmelCase			:						Dict									=      strip_accents
				__lowerCAmelCase			:						Union[str, Any]									=      tokenize_chinese_chars
				__lowerCAmelCase			:						Tuple									=      normalizer_class(**_SCREAMING_SNAKE_CASE )

			__lowerCAmelCase			:						Union[str, Any]									=      do_lower_case

		def 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE=None ):
			__lowerCAmelCase			:						List[Any]									=      [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 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE = None ):
			__lowerCAmelCase			:						List[Any]									=      [self.sep_token_id]
			__lowerCAmelCase			:						List[str]									=      [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 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE = None ):
			__lowerCAmelCase			:						List[Any]									=      self._tokenizer.model.save(_SCREAMING_SNAKE_CASE       ,		name=_SCREAMING_SNAKE_CASE )
			return tuple(_SCREAMING_SNAKE_CASE )






def        SCREAMING_SNAKE_CASE      (       _UpperCAmelCase						,	_UpperCAmelCase )			->     bool:
    lowerCamelCase__    :      List[str]					 =		len(_UpperCAmelCase )
    lowerCamelCase__    :      str					 =		[[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 ):
        lowerCamelCase__    :      Tuple					 =		True

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

    for i in range(1						,	arr_len + 1 ):
        for j in range(1						,	required_sum + 1 ):
            if arr[i - 1] > j:
                lowerCamelCase__    :      str					 =		subset[i - 1][j]
            if arr[i - 1] <= j:
                lowerCamelCase__    :      Dict					 =		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()





