
"""simple docstring"""





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_base import BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import PaddingStrategy, logging
from .tokenization_realm import RealmTokenizer


_a								=						logging.get_logger(__name__)

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

_a								=						{
    'vocab_file': {
        'google/realm-cc-news-pretrained-embedder': (
            'https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/vocab.txt'
        ),
        'google/realm-cc-news-pretrained-encoder': (
            'https://huggingface.co/google/realm-cc-news-pretrained-encoder/resolve/main/vocab.txt'
        ),
        'google/realm-cc-news-pretrained-scorer': (
            'https://huggingface.co/google/realm-cc-news-pretrained-scorer/resolve/main/vocab.txt'
        ),
        'google/realm-cc-news-pretrained-openqa': (
            'https://huggingface.co/google/realm-cc-news-pretrained-openqa/aresolve/main/vocab.txt'
        ),
        'google/realm-orqa-nq-openqa': 'https://huggingface.co/google/realm-orqa-nq-openqa/resolve/main/vocab.txt',
        'google/realm-orqa-nq-reader': 'https://huggingface.co/google/realm-orqa-nq-reader/resolve/main/vocab.txt',
        'google/realm-orqa-wq-openqa': 'https://huggingface.co/google/realm-orqa-wq-openqa/resolve/main/vocab.txt',
        'google/realm-orqa-wq-reader': 'https://huggingface.co/google/realm-orqa-wq-reader/resolve/main/vocab.txt',
    },
    'tokenizer_file': {
        'google/realm-cc-news-pretrained-embedder': (
            'https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/tokenizer.jsont'
        ),
        'google/realm-cc-news-pretrained-encoder': (
            'https://huggingface.co/google/realm-cc-news-pretrained-encoder/resolve/main/tokenizer.json'
        ),
        'google/realm-cc-news-pretrained-scorer': (
            'https://huggingface.co/google/realm-cc-news-pretrained-scorer/resolve/main/tokenizer.json'
        ),
        'google/realm-cc-news-pretrained-openqa': (
            'https://huggingface.co/google/realm-cc-news-pretrained-openqa/aresolve/main/tokenizer.json'
        ),
        'google/realm-orqa-nq-openqa': (
            'https://huggingface.co/google/realm-orqa-nq-openqa/resolve/main/tokenizer.json'
        ),
        'google/realm-orqa-nq-reader': (
            'https://huggingface.co/google/realm-orqa-nq-reader/resolve/main/tokenizer.json'
        ),
        'google/realm-orqa-wq-openqa': (
            'https://huggingface.co/google/realm-orqa-wq-openqa/resolve/main/tokenizer.json'
        ),
        'google/realm-orqa-wq-reader': (
            'https://huggingface.co/google/realm-orqa-wq-reader/resolve/main/tokenizer.json'
        ),
    },
}

_a								=						{
    'google/realm-cc-news-pretrained-embedder': 512,
    'google/realm-cc-news-pretrained-encoder': 512,
    'google/realm-cc-news-pretrained-scorer': 512,
    'google/realm-cc-news-pretrained-openqa': 512,
    'google/realm-orqa-nq-openqa': 512,
    'google/realm-orqa-nq-reader': 512,
    'google/realm-orqa-wq-openqa': 512,
    'google/realm-orqa-wq-reader': 512,
}

_a								=						{
    'google/realm-cc-news-pretrained-embedder': {'do_lower_case': True},
    'google/realm-cc-news-pretrained-encoder': {'do_lower_case': True},
    'google/realm-cc-news-pretrained-scorer': {'do_lower_case': True},
    'google/realm-cc-news-pretrained-openqa': {'do_lower_case': True},
    'google/realm-orqa-nq-openqa': {'do_lower_case': True},
    'google/realm-orqa-nq-reader': {'do_lower_case': True},
    'google/realm-orqa-wq-openqa': {'do_lower_case': True},
    'google/realm-orqa-wq-reader': {'do_lower_case': True},
}






class        _UpperCAmelCase(       __snake_case      ):
		lowercase__         = VOCAB_FILES_NAMES
		lowercase__         = PRETRAINED_VOCAB_FILES_MAP
		lowercase__         = PRETRAINED_INIT_CONFIGURATION
		lowercase__         = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
		lowercase__         = RealmTokenizer



		def __init__(   self							,						__a=None							,						__a=None							,						__a=True							,						__a="[UNK]"							,						__a="[SEP]"							,						__a="[PAD]"							,						__a="[CLS]"							,						__a="[MASK]"							,						__a=True							,						__a=None							,						**__a							,						)			->			Union[str, Any]:






							'''simple docstring'''
							super().__init__(
							    A__							,						tokenizer_file=A__							,						do_lower_case=A__							,						unk_token=A__							,						sep_token=A__							,						pad_token=A__							,						cls_token=A__							,						mask_token=A__							,						tokenize_chinese_chars=A__							,						strip_accents=A__							,						**A__							,						)

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

							_UpperCamelCase									=    do_lower_case



		def 		UpperCAmelCase				(   self							,						__a							,						**__a)			->			str:






							'''simple docstring'''
							_UpperCamelCase									=    PaddingStrategy.MAX_LENGTH

							_UpperCamelCase									=    text
							_UpperCamelCase									=    kwargs.pop('''text_pair'''							,						A__)
							_UpperCamelCase									=    kwargs.pop('''return_tensors'''							,						A__)

							_UpperCamelCase									=    {
							    '''input_ids''': [],
							    '''attention_mask''': [],
							    '''token_type_ids''': [],
							}

							for idx, candidate_text in enumerate(A__):
												if batch_text_pair is not None:
																	_UpperCamelCase									=    batch_text_pair[idx]
												else:
																	_UpperCamelCase									=    None

												_UpperCamelCase									=    super().__call__(A__							,						A__							,						return_tensors=A__							,						**A__)

												_UpperCamelCase									=    encoded_candidates.get('''input_ids''')
												_UpperCamelCase									=    encoded_candidates.get('''attention_mask''')
												_UpperCamelCase									=    encoded_candidates.get('''token_type_ids''')

												if encoded_input_ids is not None:
																	output_data["input_ids"].append(A__)
												if encoded_attention_mask is not None:
																	output_data["attention_mask"].append(A__)
												if encoded_token_type_ids is not None:
																	output_data["token_type_ids"].append(A__)

							_UpperCamelCase									=    {key: item for key, item in output_data.items() if len(A__) != 0}

							return BatchEncoding(A__							,						tensor_type=A__)



		def 		UpperCAmelCase				(   self							,						__a							,						__a=None)			->			int:






							'''simple docstring'''
							_UpperCamelCase									=    [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							,						__a							,						__a = None)			->			Any:






							'''simple docstring'''
							_UpperCamelCase									=    [self.sep_token_id]
							_UpperCamelCase									=    [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							,						__a							,						__a = None)			->			List[str]:






							'''simple docstring'''
							_UpperCamelCase									=    self._tokenizer.model.save(A__							,						name=A__)
							return tuple(A__)














def  a__ (__lowercase							:int					,  __lowercase							:int   )		-> int:
				return abs(__lowercase   ) if a == 0 else greatest_common_divisor(b % a					,  __lowercase   )



def  a__ (__lowercase							:int					,  __lowercase							:int   )		-> int:
				while y:  # --> when y=0 then loop will terminate and return x as final GCD.
								_A  ,				_A	:				Union[str, Any]   =      y, x % y
				return abs(__lowercase   )



def  a__ ()		-> Optional[Any]:
				try:
								_A	:				Optional[Any]   =      input('''Enter two integers separated by comma (,): '''   ).split(''','''   )
								_A	:				List[Any]   =      int(nums[0]   )
								_A	:				Optional[int]   =      int(nums[1]   )
								print(
								    f"""greatest_common_divisor({num_a}, {num_a}) = """
								    f"""{greatest_common_divisor(__lowercase					,  __lowercase   )}"""   )
								print(f"""By iterative gcd({num_a}, {num_a}) = {gcd_by_iterative(__lowercase					,  __lowercase   )}"""   )
				except (IndexError, UnboundLocalError, ValueError):
								print('''Wrong input'''   )


if __name__ == "__main__":
	main()



