import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_electra import ElectraTokenizer


_UpperCAmelCase          =						{"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

_UpperCAmelCase          =						{
    """vocab_file""": {
        """google/electra-small-generator""": (
            """https://huggingface.co/google/electra-small-generator/resolve/main/vocab.txt"""
        ),
        """google/electra-base-generator""": """https://huggingface.co/google/electra-base-generator/resolve/main/vocab.txt""",
        """google/electra-large-generator""": (
            """https://huggingface.co/google/electra-large-generator/resolve/main/vocab.txt"""
        ),
        """google/electra-small-discriminator""": (
            """https://huggingface.co/google/electra-small-discriminator/resolve/main/vocab.txt"""
        ),
        """google/electra-base-discriminator""": (
            """https://huggingface.co/google/electra-base-discriminator/resolve/main/vocab.txt"""
        ),
        """google/electra-large-discriminator""": (
            """https://huggingface.co/google/electra-large-discriminator/resolve/main/vocab.txt"""
        ),
    },
    """tokenizer_file""": {
        """google/electra-small-generator""": (
            """https://huggingface.co/google/electra-small-generator/resolve/main/tokenizer.json"""
        ),
        """google/electra-base-generator""": (
            """https://huggingface.co/google/electra-base-generator/resolve/main/tokenizer.json"""
        ),
        """google/electra-large-generator""": (
            """https://huggingface.co/google/electra-large-generator/resolve/main/tokenizer.json"""
        ),
        """google/electra-small-discriminator""": (
            """https://huggingface.co/google/electra-small-discriminator/resolve/main/tokenizer.json"""
        ),
        """google/electra-base-discriminator""": (
            """https://huggingface.co/google/electra-base-discriminator/resolve/main/tokenizer.json"""
        ),
        """google/electra-large-discriminator""": (
            """https://huggingface.co/google/electra-large-discriminator/resolve/main/tokenizer.json"""
        ),
    },
}

_UpperCAmelCase          =						{
    """google/electra-small-generator""": 512,
    """google/electra-base-generator""": 512,
    """google/electra-large-generator""": 512,
    """google/electra-small-discriminator""": 512,
    """google/electra-base-discriminator""": 512,
    """google/electra-large-discriminator""": 512,
}

_UpperCAmelCase          =						{
    """google/electra-small-generator""": {"""do_lower_case""": True},
    """google/electra-base-generator""": {"""do_lower_case""": True},
    """google/electra-large-generator""": {"""do_lower_case""": True},
    """google/electra-small-discriminator""": {"""do_lower_case""": True},
    """google/electra-base-discriminator""": {"""do_lower_case""": True},
    """google/electra-large-discriminator""": {"""do_lower_case""": True},
}





class UpperCAmelCase		(   __A    ):


				'''simple docstring'''






				lowerCamelCase_        =   VOCAB_FILES_NAMES
				lowerCamelCase_        =   PRETRAINED_VOCAB_FILES_MAP
				lowerCamelCase_        =   PRETRAINED_INIT_CONFIGURATION
				lowerCamelCase_        =   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				lowerCamelCase_        =   ElectraTokenizer
				def __init__(		self						,      lowercase=None						,      lowercase=None						,      lowercase=True						,      lowercase="[UNK]"						,      lowercase="[SEP]"						,      lowercase="[PAD]"						,      lowercase="[CLS]"						,      lowercase="[MASK]"						,      lowercase=True						,      lowercase=None						,      **lowercase						,      ):



						"""simple docstring"""





						super().__init__(
						    lowercase						,      tokenizer_file=lowercase						,      do_lower_case=lowercase						,      unk_token=lowercase						,      sep_token=lowercase						,      pad_token=lowercase						,      cls_token=lowercase						,      mask_token=lowercase						,      tokenize_chinese_chars=lowercase						,      strip_accents=lowercase						,      **lowercase						,      )

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

						A_						:							Optional[Any]      = do_lower_case
				def     lowerCAmelCase_  (		self						,      lowercase						,      lowercase=None   ):



						"""simple docstring"""





						A_						:							Tuple      = [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						,      lowercase						,      lowercase = None   ):



						"""simple docstring"""





						A_						:							Any      = [self.sep_token_id]
						A_						:							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						,      lowercase						,      lowercase = None   ):



						"""simple docstring"""





						A_						:							Optional[int]      = self._tokenizer.model.save(lowercase						,      name=lowercase   )
						return tuple(lowercase   )







def 							UpperCamelCase		(			__lowercase		:					Optional[Any]		,__lowercase		:					List[Any]		,__lowercase		:					Tuple      ):
		'''simple docstring'''




		if n == 0:
				return 1

		elif n % 2 == 1:
				return (binary_exponentiation(__lowercase		,n - 1		,__lowercase      ) * a) % mod

		else:
				A_						:							str      = binary_exponentiation(__lowercase		,n / 2		,__lowercase      )
				return (b * b) % mod


# a prime number
_UpperCAmelCase          =						701

_UpperCAmelCase          =						1000000000
_UpperCAmelCase          =						10

# using binary exponentiation function, O(log(p)):
print((a / b) % p == (a * binary_exponentiation(b, p - 2, p)) % p)


print((a / b) % p == (a * b ** (p - 2)) % p)






