






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


_A	:			Tuple         ={'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

_A	:			Tuple         ={
    '''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'''
        ),
    },
}

_A	:			Optional[Any]         ={
    '''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,
}

_A	:			Optional[Any]         ={
    '''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	(				_lowercase		):
							a				      =       VOCAB_FILES_NAMES
							a				      =       PRETRAINED_VOCAB_FILES_MAP
							a				      =       PRETRAINED_INIT_CONFIGURATION
							a				      =       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							a				      =       ElectraTokenizer




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

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

														lowerCamelCase__					:	Optional[Any]         =       do_lower_case




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









'''simple docstring'''







from heapq import heappop, heappush

import numpy as np





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase				,			)      ->       tuple[float | int, list[tuple[int, int]]]:
							lowerCamelCase__  ,		lowerCamelCase__					:	Union[str, Any]         =       grid.shape
							lowerCamelCase__					:	List[str]         =       [-1, 1, 0, 0]
							lowerCamelCase__					:	Dict         =       [0, 0, -1, 1]
							if allow_diagonal:
														dx += [-1, -1, 1, 1]
														dy += [-1, 1, -1, 1]

							lowerCamelCase__  ,		lowerCamelCase__					:	Any         =       [(0, source)], set()
							lowerCamelCase__					:	Tuple         =       np.full((rows, cols)				,			np.inf      )
							lowerCamelCase__					:	List[str]         =       0
							lowerCamelCase__					:	Optional[int]         =       np.empty((rows, cols)				,			dtype=UpperCamelCase      )
							lowerCamelCase__					:	str         =       None

							while queue:
														((lowerCamelCase__)  ,		(lowerCamelCase__))					:	List[str]         =       heappop(UpperCamelCase      )
														if (x, y) in visited:
																					continue
														visited.add((x, y)      )

														if (x, y) == destination:
																					lowerCamelCase__					:	Optional[int]         =       []
																					while (x, y) != source:
																												path.append((x, y)      )
																												lowerCamelCase__  ,		lowerCamelCase__					:	List[Any]         =       predecessors[x, y]
																					path.append(UpperCamelCase      )  # add the source manually
																					path.reverse()
																					return matrix[destination], path

														for i in range(len(UpperCamelCase      )      ):
																					lowerCamelCase__  ,		lowerCamelCase__					:	Union[str, Any]         =       x + dx[i], y + dy[i]
																					if 0 <= nx < rows and 0 <= ny < cols:
																												lowerCamelCase__					:	Any         =       grid[nx][ny]
																												if next_node == 1 and matrix[nx, ny] > dist + 1:
																																			heappush(UpperCamelCase				,			(dist + 1, (nx, ny))      )
																																			lowerCamelCase__					:	Union[str, Any]         =       dist + 1
																																			lowerCamelCase__					:	List[str]         =       (x, y)

							return np.inf, []


if __name__ == "__main__":
			import doctest

			doctest.testmod()

