


import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

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


snake_case							: List[str]      =   {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

snake_case							: List[Any]      =   {
    '''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'''
        ),
    },
}

snake_case							: str      =   {
    '''google/electra-small-generator''': 5_12,
    '''google/electra-base-generator''': 5_12,
    '''google/electra-large-generator''': 5_12,
    '''google/electra-small-discriminator''': 5_12,
    '''google/electra-base-discriminator''': 5_12,
    '''google/electra-large-discriminator''': 5_12,
}

snake_case							: int      =   {
    '''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  snake_case_     (lowerCamelCase_   ):
					UpperCAmelCase__      :					List[Any]					   =    VOCAB_FILES_NAMES
					UpperCAmelCase__      :					str					   =    PRETRAINED_VOCAB_FILES_MAP
					UpperCAmelCase__      :					int					   =    PRETRAINED_INIT_CONFIGURATION
					UpperCAmelCase__      :					Any					   =    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
					UpperCAmelCase__      :					Dict					   =    ElectraTokenizer
					def __init__(   self     :Any    ,__snake_case     :Dict=None    ,__snake_case     :Optional[int]=None    ,__snake_case     :List[Any]=True    ,__snake_case     :Union[str, Any]="[UNK]"    ,__snake_case     :int="[SEP]"    ,__snake_case     :str="[PAD]"    ,__snake_case     :Tuple="[CLS]"    ,__snake_case     :List[str]="[MASK]"    ,__snake_case     :Tuple=True    ,__snake_case     :List[str]=None    ,**__snake_case     :int    ,)      ->					int:
												super().__init__(
												    __snake_case    ,tokenizer_file=__snake_case    ,do_lower_case=__snake_case    ,unk_token=__snake_case    ,sep_token=__snake_case    ,pad_token=__snake_case    ,cls_token=__snake_case    ,mask_token=__snake_case    ,tokenize_chinese_chars=__snake_case    ,strip_accents=__snake_case    ,**__snake_case    ,)

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

												a__    =  do_lower_case
					def 				lowerCamelCase__(   self     :Dict    ,__snake_case     :Optional[Any]    ,__snake_case     :List[str]=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 				lowerCamelCase__(   self     :Any    ,__snake_case     :List[int]    ,__snake_case     :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 				lowerCamelCase__(   self     :Tuple    ,__snake_case     :str    ,__snake_case     :Optional[str] = None   )      ->					Tuple[str]:
												a__    =  self._tokenizer.model.save(__snake_case    ,name=__snake_case   )
												return tuple(__snake_case   )








from __future__ import annotations






def 							__lowercase     (				__lowerCAmelCase							:       list[int]     ):  # This function is recursive
							a__    =  len(__lowerCAmelCase     )
							# If the array contains only one element, we return it (it's the stop condition of
							# recursion)
							if array_length <= 1:
														return array
														# Else
							a__    =  array[0]
							a__    =  False
							a__    =  1
							a__    =  []
							while not is_found and i < array_length:
														if array[i] < pivot:
																					a__    =  True
																					a__    =  [element for element in array[i:] if element >= array[i]]
																					a__    =  longest_subsequence(__lowerCAmelCase     )
																					if len(__lowerCAmelCase     ) > len(__lowerCAmelCase     ):
																												a__    =  temp_array
														else:
																					i += 1

							a__    =  [element for element in array[1:] if element >= pivot]
							a__    =  [pivot, *longest_subsequence(__lowerCAmelCase     )]
							if len(__lowerCAmelCase     ) > len(__lowerCAmelCase     ):
														return temp_array
							else:
														return longest_subseq


if __name__ == "__main__":
						import doctest

						doctest.testmod()




