



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoFormerTokenizer
from .tokenization_utils import JiebaPreTokenizer


__snake_case     :List[Any]			       =logging.get_logger(__name__)

__snake_case     :Union[str, Any]			       ={'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'}

__snake_case     :Tuple			       ={
    'vocab_file': {
        'junnyu/roformer_chinese_small': 'https://huggingface.co/junnyu/roformer_chinese_small/resolve/main/vocab.txt',
        'junnyu/roformer_chinese_base': 'https://huggingface.co/junnyu/roformer_chinese_base/resolve/main/vocab.txt',
        'junnyu/roformer_chinese_char_small': (
            'https://huggingface.co/junnyu/roformer_chinese_char_small/resolve/main/vocab.txt'
        ),
        'junnyu/roformer_chinese_char_base': (
            'https://huggingface.co/junnyu/roformer_chinese_char_base/resolve/main/vocab.txt'
        ),
        'junnyu/roformer_small_discriminator': (
            'https://huggingface.co/junnyu/roformer_small_discriminator/resolve/main/vocab.txt'
        ),
        'junnyu/roformer_small_generator': (
            'https://huggingface.co/junnyu/roformer_small_generator/resolve/main/vocab.txt'
        ),
    }
}

__snake_case     :str			       ={
    'junnyu/roformer_chinese_small': 1536,
    'junnyu/roformer_chinese_base': 1536,
    'junnyu/roformer_chinese_char_small': 512,
    'junnyu/roformer_chinese_char_base': 512,
    'junnyu/roformer_small_discriminator': 128,
    'junnyu/roformer_small_generator': 128,
}


__snake_case     :List[Any]			       ={
    'junnyu/roformer_chinese_small': {'do_lower_case': True},
    'junnyu/roformer_chinese_base': {'do_lower_case': True},
    'junnyu/roformer_chinese_char_small': {'do_lower_case': True},
    'junnyu/roformer_chinese_char_base': {'do_lower_case': True},
    'junnyu/roformer_small_discriminator': {'do_lower_case': True},
    'junnyu/roformer_small_generator': {'do_lower_case': True},
}



class        lowerCAmelCase__					(  _lowerCamelCase       ):
				A_   :     Optional[Any]								=     VOCAB_FILES_NAMES
				A_   :     str								=     PRETRAINED_VOCAB_FILES_MAP
				A_   :     Optional[int]								=     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				A_   :     Tuple								=     PRETRAINED_INIT_CONFIGURATION
				A_   :     Optional[Any]								=     RoFormerTokenizer


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

											A      						=    json.loads(self.backend_tokenizer.normalizer.__getstate__()       )
											if (
											    pre_tok_state.get('lowercase'						, __UpperCamelCase       ) != do_lower_case
											    or pre_tok_state.get('strip_accents'						, __UpperCamelCase       ) != strip_accents
											):
																		A      						=    getattr(__UpperCamelCase						, pre_tok_state.pop('type'       )       )
																		A      						=    do_lower_case
																		A      						=    strip_accents
																		A      						=    pre_tok_class(**__UpperCamelCase       )

											A      						=    do_lower_case


				def __getstate__(							self      :  str       )		->     Optional[int]:
											A      						=    self.__dict__.copy()
											A      						=    BertPreTokenizer()
											return state


				def __setstate__(							self      :  Dict						, __UpperCamelCase      :  Any       )		->     str:
											A      						=    d
											A      						=    self.__dict__['_tokenizer'].get_vocab()
											A      						=    PreTokenizer.custom(JiebaPreTokenizer(__UpperCamelCase       )       )


				def __UpperCamelCase						(							self      :  str						, __UpperCamelCase      :  Optional[int]						, __UpperCamelCase      :  Optional[int]=None       )		->     Union[str, Any]:
											A      						=    [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      :  Any						, __UpperCamelCase      :  List[int]						, __UpperCamelCase      :  Optional[List[int]] = None       )		->     List[int]:
											A      						=    [self.sep_token_id]
											A      						=    [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      :  Optional[int]						, __UpperCamelCase      :  str						, __UpperCamelCase      :  Optional[str] = None       )		->     Tuple[str]:
											A      						=    self._tokenizer.model.save(__UpperCamelCase						, name=__UpperCamelCase       )
											return tuple(__UpperCamelCase       )


				def __UpperCamelCase						(							self      :  Optional[int]						, __UpperCamelCase      :  Optional[Any]						, __UpperCamelCase      :  Optional[int]=None						, __UpperCamelCase      :  Optional[int]=None						, __UpperCamelCase      :  List[str]=False						, **__UpperCamelCase      :  Union[str, Any]						, )		->     Optional[Any]:
											A      						=    BertPreTokenizer()
											return super().save_pretrained(__UpperCamelCase						, __UpperCamelCase						, __UpperCamelCase						, __UpperCamelCase						, **__UpperCamelCase       )

from __future__ import annotations

import math





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase				):

    if 1 < number < 4:
        # 2 and 3 are primes
        return True
    elif number < 2 or number % 2 == 0 or number % 3 == 0:
        # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
        return False

    # All primes number are in format of 6k +/- 1
    for i in range(5     ,		int(math.sqrt(__lowerCAmelCase				) + 1				)     ,		6				):
        if number % i == 0 or number % (i + 2) == 0:
            return False
    return True





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase				):
    snake_case__    =					str(__lowerCAmelCase				)
    snake_case__    =					[n]
    for i in range(1     ,		len(__lowerCAmelCase				)				):
        list_nums.append(int(str_num[i:]				)				)
        list_nums.append(int(str_num[:-i]				)				)
    return list_nums





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase				):
    if len(str(__lowerCAmelCase				)				) > 3:
        if not is_prime(int(str(__lowerCAmelCase				)[-3:]				)				) or not is_prime(int(str(__lowerCAmelCase				)[:3]				)				):
            return False
    return True





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase = 11				):
    snake_case__    =					[]
    snake_case__    =					13
    while len(__lowerCAmelCase				) != count:
        if validate(__lowerCAmelCase				):
            snake_case__    =					list_truncated_nums(__lowerCAmelCase				)
            if all(is_prime(__lowerCAmelCase				) for i in list_nums				):
                list_truncated_primes.append(__lowerCAmelCase				)
        num += 2
    return list_truncated_primes





def 						SCREAMING_SNAKE_CASE__     (   ):
    return sum(compute_truncated_primes(11				)				)


if __name__ == "__main__":
     print(F'''{sum(compute_truncated_primes(11)) = }''')



