

'''simple docstring'''





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


UpperCamelCase_							=					logging.get_logger(__name__)

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

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

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


UpperCamelCase_							=					{
    """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 		__SCREAMING_SNAKE_CASE       ( lowercase__			):
				lowerCamelCase_							=						VOCAB_FILES_NAMES
				lowerCamelCase_							=						PRETRAINED_VOCAB_FILES_MAP
				lowerCamelCase_							=						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				lowerCamelCase_							=						PRETRAINED_INIT_CONFIGURATION
				lowerCamelCase_							=						RoFormerTokenizer







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

										lowercase   :       Tuple								=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
										):
																lowercase   :       Optional[Any]								=getattr(UpperCAmelCase__		,				pre_tok_state.pop('''type'''      )      )
																lowercase   :       Dict								=do_lower_case
																lowercase   :       Union[str, Any]								=strip_accents
																lowercase   :       str								=pre_tok_class(**UpperCAmelCase__      )

										lowercase   :       int								=do_lower_case







				def __getstate__(					self    :		Optional[Any]      ):
										'''simple docstring'''
										lowercase   :       List[Any]								=self.__dict__.copy()
										lowercase   :       List[Any]								=BertPreTokenizer()
										return state







				def __setstate__(					self    :		List[Any]		,				UpperCAmelCase__    :		int      ):
										'''simple docstring'''
										lowercase   :       Tuple								=d
										lowercase   :       str								=self.__dict__['''_tokenizer'''].get_vocab()
										lowercase   :       List[str]								=PreTokenizer.custom(JiebaPreTokenizer(UpperCAmelCase__      )      )







				def    lowerCamelCase_  (					self    :		Dict		,				UpperCAmelCase__    :		Optional[Any]		,				UpperCAmelCase__    :		Any=None      ):
										'''simple docstring'''
										lowercase   :       Optional[int]								=[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    :		Optional[int]		,				UpperCAmelCase__    :		List[int]		,				UpperCAmelCase__    :		Optional[List[int]] = None      ):
										'''simple docstring'''
										lowercase   :       Optional[int]								=[self.sep_token_id]
										lowercase   :       Tuple								=[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    :		Dict		,				UpperCAmelCase__    :		str		,				UpperCAmelCase__    :		Optional[str] = None      ):
										'''simple docstring'''
										lowercase   :       Tuple								=self._tokenizer.model.save(UpperCAmelCase__		,				name=UpperCAmelCase__      )
										return tuple(UpperCAmelCase__      )







				def    lowerCamelCase_  (					self    :		Tuple		,				UpperCAmelCase__    :		List[Any]		,				UpperCAmelCase__    :		List[str]=None		,				UpperCAmelCase__    :		Optional[Any]=None		,				UpperCAmelCase__    :		int=False		,				**UpperCAmelCase__    :		Any		,				):
										'''simple docstring'''
										lowercase   :       Optional[int]								=BertPreTokenizer()
										return super().save_pretrained(UpperCAmelCase__		,				UpperCAmelCase__		,				UpperCAmelCase__		,				UpperCAmelCase__		,				**UpperCAmelCase__      )








'''simple docstring'''





from __future__ import annotations






def 							_lowerCAmelCase (      __magic_name__	:    list[list[int]]	)							->     bool:
						lowercase   :       str								=len(__magic_name__	)
						# We need to create solution object to save path.
						lowercase   :       int								=[[0 for _ in range(__magic_name__	)] for _ in range(__magic_name__	)]
						lowercase   :       List[Any]								=run_maze(__magic_name__      ,   0      ,   0      ,   __magic_name__	)
						if solved:
												print('''\n'''.join(str(__magic_name__	) for row in solutions	)	)
						else:
												print('''No solution exists!'''	)
						return solved






def 							_lowerCAmelCase (      __magic_name__	:    list[list[int]]      ,   __magic_name__	:    int      ,   __magic_name__	:    int      ,   __magic_name__	:    list[list[int]]	)							->     bool:
						lowercase   :       Optional[int]								=len(__magic_name__	)
						# Final check point.
						if i == j == (size - 1):
												lowercase   :       Optional[int]								=1
												return True

						lowercase   :       Optional[int]								=(not i < 0) and (not j < 0)  # Check lower bounds
						lowercase   :       Tuple								=(i < size) and (j < size)  # Check upper bounds

						if lower_flag and upper_flag:
												# check for already visited and block points.
												lowercase   :       Union[str, Any]								=(not solutions[i][j]) and (not maze[i][j])
												if block_flag:
																		# check visited
																		lowercase   :       Union[str, Any]								=1

																		# check for directions
																		if (
																		    run_maze(__magic_name__      ,   i + 1      ,   __magic_name__      ,   __magic_name__	)
																		    or run_maze(__magic_name__      ,   __magic_name__      ,   j + 1      ,   __magic_name__	)
																		    or run_maze(__magic_name__      ,   i - 1      ,   __magic_name__      ,   __magic_name__	)
																		    or run_maze(__magic_name__      ,   __magic_name__      ,   j - 1      ,   __magic_name__	)
																		):
																								return True

																		lowercase   :       str								=0
																		return False
						return False


if __name__ == "__main__":
							import doctest

							doctest.testmod()





