





'''simple docstring'''



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

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


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

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

_SCREAMING_SNAKE_CASE					=    {
    """google/electra-small-generator""": 5_1_2,
    """google/electra-base-generator""": 5_1_2,
    """google/electra-large-generator""": 5_1_2,
    """google/electra-small-discriminator""": 5_1_2,
    """google/electra-base-discriminator""": 5_1_2,
    """google/electra-large-discriminator""": 5_1_2,
}

_SCREAMING_SNAKE_CASE					=    {
    """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 							__lowercase       (      lowerCAmelCase__						):







	'''simple docstring'''

	a    :				List[Any]											=       VOCAB_FILES_NAMES
	a    :				List[Any]											=       PRETRAINED_VOCAB_FILES_MAP
	a    :				List[Any]											=       PRETRAINED_INIT_CONFIGURATION
	a    :				Dict											=       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	a    :				Any											=       ElectraTokenizer


	def __init__(self     ,_lowerCamelCase=None     ,_lowerCamelCase=None     ,_lowerCamelCase=True     ,_lowerCamelCase="[UNK]"     ,_lowerCamelCase="[SEP]"     ,_lowerCamelCase="[PAD]"     ,_lowerCamelCase="[CLS]"     ,_lowerCamelCase="[MASK]"     ,_lowerCamelCase=True     ,_lowerCamelCase=None     ,**_lowerCamelCase     ,)							->							int:







				'''simple docstring'''





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

				__lowercase										=							json.loads(self.backend_tokenizer.normalizer.__getstate__() )
				if (
				    normalizer_state.get('''lowercase'''     ,_lowerCamelCase ) != do_lower_case
				    or normalizer_state.get('''strip_accents'''     ,_lowerCamelCase ) != strip_accents
				    or normalizer_state.get('''handle_chinese_chars'''     ,_lowerCamelCase ) != tokenize_chinese_chars
				):
							__lowercase										=							getattr(_lowerCamelCase     ,normalizer_state.pop('''type''' ) )
							__lowercase										=							do_lower_case
							__lowercase										=							strip_accents
							__lowercase										=							tokenize_chinese_chars
							__lowercase										=							normalizer_class(**_lowerCamelCase )

				__lowercase										=							do_lower_case


	def 						_UpperCAmelCase     (self     ,_lowerCamelCase     ,_lowerCamelCase=None )							->							List[Any]:







				'''simple docstring'''





				__lowercase										=							[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     ,_lowerCamelCase     ,_lowerCamelCase = None )							->							List[int]:







				'''simple docstring'''





				__lowercase										=							[self.sep_token_id]
				__lowercase										=							[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     ,_lowerCamelCase     ,_lowerCamelCase = None )							->							Tuple[str]:







				'''simple docstring'''





				__lowercase										=							self._tokenizer.model.save(_lowerCamelCase     ,name=_lowerCamelCase )
				return tuple(_lowerCamelCase )












'''simple docstring'''



from __future__ import annotations

import time
from collections.abc import Sequence
from random import randint

from matplotlib import pyplot as plt




def    _lowerCAmelCase						(				lowerCamelCase_			:  Sequence[float]		,       lowerCamelCase_			:  int		,       lowerCamelCase_			:  int				):
			if not arr:
						return None, None, 0
			if low == high:
						return low, high, arr[low]

			__lowercase										=							(low + high) // 2
			__lowercase						,		__lowercase						,		__lowercase										=							max_subarray(lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_				)
			__lowercase						,		__lowercase						,		__lowercase										=							max_subarray(lowerCamelCase_		,       mid + 1		,       lowerCamelCase_				)
			__lowercase						,		__lowercase						,		__lowercase										=							max_cross_sum(lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_				)
			if left_sum >= right_sum and left_sum >= cross_sum:
						return left_low, left_high, left_sum
			elif right_sum >= left_sum and right_sum >= cross_sum:
						return right_low, right_high, right_sum
			return cross_left, cross_right, cross_sum




def    _lowerCAmelCase						(				lowerCamelCase_			:  Sequence[float]		,       lowerCamelCase_			:  int		,       lowerCamelCase_			:  int		,       lowerCamelCase_			:  int				):
			__lowercase						,		__lowercase										=							float('''-inf'''				), -1
			__lowercase						,		__lowercase										=							float('''-inf'''				), -1

			__lowercase										=							0
			for i in range(lowerCamelCase_		,       low - 1		,       -1				):
						summ += arr[i]
						if summ > left_sum:
									__lowercase										=							summ
									__lowercase										=							i

			__lowercase										=							0
			for i in range(mid + 1		,       high + 1				):
						summ += arr[i]
						if summ > right_sum:
									__lowercase										=							summ
									__lowercase										=							i

			return max_left, max_right, (left_sum + right_sum)




def    _lowerCAmelCase						(				lowerCamelCase_			:  int				):
			__lowercase										=							[randint(1		,       lowerCamelCase_				) for _ in range(lowerCamelCase_				)]
			__lowercase										=							time.time()
			max_subarray(lowerCamelCase_		,       0		,       input_size - 1				)
			__lowercase										=							time.time()
			return end - start




def    _lowerCAmelCase						(				):
			__lowercase										=							[1_0, 1_0_0, 1_0_0_0, 1_0_0_0_0, 5_0_0_0_0, 1_0_0_0_0_0, 2_0_0_0_0_0, 3_0_0_0_0_0, 4_0_0_0_0_0, 5_0_0_0_0_0]
			__lowercase										=							[time_max_subarray(lowerCamelCase_				) for input_size in input_sizes]
			print('''No of Inputs\t\tTime Taken'''				)
			for input_size, runtime in zip(lowerCamelCase_		,       lowerCamelCase_				):
						print(lowerCamelCase_		,       '''\t\t'''		,       lowerCamelCase_				)
			plt.plot(lowerCamelCase_		,       lowerCamelCase_				)
			plt.xlabel('''Number of Inputs'''				)
			plt.ylabel('''Time taken in seconds'''				)
			plt.show()


if __name__ == "__main__":
	from doctest import testmod

	testmod()





