
'''simple docstring'''

import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_splinter import SplinterTokenizer


UpperCAmelCase__				:	Optional[Any]					=						logging.get_logger(__name__)

UpperCAmelCase__				:	Dict					=						{"vocab_file": "vocab.txt"}

UpperCAmelCase__				:	Optional[Any]					=						{
    "vocab_file": {
        "tau/splinter-base": "https://huggingface.co/tau/splinter-base/resolve/main/vocab.txt",
        "tau/splinter-base-qass": "https://huggingface.co/tau/splinter-base-qass/resolve/main/vocab.txt",
        "tau/splinter-large": "https://huggingface.co/tau/splinter-large/resolve/main/vocab.txt",
        "tau/splinter-large-qass": "https://huggingface.co/tau/splinter-large-qass/resolve/main/vocab.txt",
    }
}

UpperCAmelCase__				:	Tuple					=						{
    "tau/splinter-base": 5_12,
    "tau/splinter-base-qass": 5_12,
    "tau/splinter-large": 5_12,
    "tau/splinter-large-qass": 5_12,
}

UpperCAmelCase__				:	Optional[int]					=						{
    "tau/splinter-base": {"do_lower_case": False},
    "tau/splinter-base-qass": {"do_lower_case": False},
    "tau/splinter-large": {"do_lower_case": False},
    "tau/splinter-large-qass": {"do_lower_case": False},
}






class 				A       (		SCREAMING_SNAKE_CASE__      ):
	snake_case__ :List[str]				       =       VOCAB_FILES_NAMES
	snake_case__ :str				       =       PRETRAINED_VOCAB_FILES_MAP
	snake_case__ :Optional[Any]				       =       PRETRAINED_INIT_CONFIGURATION
	snake_case__ :Dict				       =       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	snake_case__ :Dict				       =       SplinterTokenizer





	def __init__(   self     :    Optional[int] ,							__magic_name__     :    Tuple=None ,							__magic_name__     :    List[Any]=None ,							__magic_name__     :    Union[str, Any]=True ,							__magic_name__     :    Tuple="[UNK]" ,							__magic_name__     :    Any="[SEP]" ,							__magic_name__     :    Dict="[PAD]" ,							__magic_name__     :    int="[CLS]" ,							__magic_name__     :    Union[str, Any]="[MASK]" ,							__magic_name__     :    str="[QUESTION]" ,							__magic_name__     :    Optional[int]=True ,							__magic_name__     :    Optional[int]=None ,							**__magic_name__     :    Any ,							):


				"""simple docstring"""

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

				lowerCAmelCase__									=							json.loads(self.backend_tokenizer.normalizer.__getstate__()							)
				if (
				    pre_tok_state.get("lowercase" ,							__magic_name__							) != do_lower_case
				    or pre_tok_state.get("strip_accents" ,							__magic_name__							) != strip_accents
				):
							lowerCAmelCase__									=							getattr(__magic_name__ ,							pre_tok_state.pop("type"							)							)
							lowerCAmelCase__									=							do_lower_case
							lowerCAmelCase__									=							strip_accents
							lowerCAmelCase__									=							pre_tok_class(**__magic_name__							)

				lowerCAmelCase__									=							do_lower_case





	@property
	def 							__SCREAMING_SNAKE_CASE					(   self     :    str							):


				"""simple docstring"""

				return self.convert_tokens_to_ids(self.question_token							)





	def 							__SCREAMING_SNAKE_CASE					(   self     :    Union[str, Any] ,							__magic_name__     :    List[int] ,							__magic_name__     :    Optional[List[int]] = None							):


				"""simple docstring"""

				if token_ids_a is None:
							return [self.cls_token_id] + token_ids_a + [self.sep_token_id]

				lowerCAmelCase__									=							[self.cls_token_id]
				lowerCAmelCase__									=							[self.sep_token_id]
				lowerCAmelCase__									=							[self.question_token_id] + [self.convert_tokens_to_ids("."							)]
				if self.padding_side == "right":
							# Input is question-then-context
							return cls + token_ids_a + question_suffix + sep + token_ids_a + sep
				else:
							# Input is context-then-question
							return cls + token_ids_a + sep + token_ids_a + question_suffix + sep





	def 							__SCREAMING_SNAKE_CASE					(   self     :    Union[str, Any] ,							__magic_name__     :    List[int] ,							__magic_name__     :    Optional[List[int]] = None							):


				"""simple docstring"""

				lowerCAmelCase__									=							[self.sep_token_id]
				lowerCAmelCase__									=							[self.cls_token_id]
				lowerCAmelCase__									=							[self.question_token_id] + [self.convert_tokens_to_ids("."							)]
				if token_ids_a is None:
							return len(cls + token_ids_a + sep							) * [0]

				if self.padding_side == "right":
							# Input is question-then-context
							return len(cls + token_ids_a + question_suffix + sep							) * [0] + len(token_ids_a + sep							) * [1]
				else:
							# Input is context-then-question
							return len(cls + token_ids_a + sep							) * [0] + len(token_ids_a + question_suffix + sep							) * [1]







	def 							__SCREAMING_SNAKE_CASE					(   self     :    str ,							__magic_name__     :    str ,							__magic_name__     :    Optional[str] = None							):


				"""simple docstring"""

				lowerCAmelCase__									=							self._tokenizer.model.save(__magic_name__ ,							name=__magic_name__							)
				return tuple(__magic_name__							)








'''simple docstring'''

import math







def 					A       ( UpperCamelCase_   :       int )   ->    list:







			'''simple docstring'''



			if n <= 0:
						raise ValueError("Only positive integers have prime factors" )
			lowerCAmelCase__									=							[]
			while n % 2 == 0:
						pf.append(2 )
						lowerCAmelCase__									=							int(n / 2 )
			for i in range(3  ,		int(math.sqrt(UpperCamelCase_ ) ) + 1  ,		2 ):
						while n % i == 0:
									pf.append(UpperCamelCase_ )
									lowerCAmelCase__									=							int(n / i )
			if n > 2:
						pf.append(UpperCamelCase_ )
			return pf







def 					A       ( UpperCamelCase_   :       int )   ->    int:







			'''simple docstring'''



			if n <= 0:
						raise ValueError("Only positive numbers are accepted" )
			lowerCAmelCase__									=							1
			lowerCAmelCase__									=							1
			while n % 2 == 0:
						temp += 1
						lowerCAmelCase__									=							int(n / 2 )
			div *= temp
			for i in range(3  ,		int(math.sqrt(UpperCamelCase_ ) ) + 1  ,		2 ):
						lowerCAmelCase__									=							1
						while n % i == 0:
									temp += 1
									lowerCAmelCase__									=							int(n / i )
						div *= temp
			if n > 1:
						div *= 2
			return div







def 					A       ( UpperCamelCase_   :       int )   ->    int:







			'''simple docstring'''



			if n <= 0:
						raise ValueError("Only positive numbers are accepted" )
			lowerCAmelCase__									=							1
			lowerCAmelCase__									=							1
			while n % 2 == 0:
						temp += 1
						lowerCAmelCase__									=							int(n / 2 )
			if temp > 1:
						s *= (2**temp - 1) / (2 - 1)
			for i in range(3  ,		int(math.sqrt(UpperCamelCase_ ) ) + 1  ,		2 ):
						lowerCAmelCase__									=							1
						while n % i == 0:
									temp += 1
									lowerCAmelCase__									=							int(n / i )
						if temp > 1:
									s *= (i**temp - 1) / (i - 1)
			return int(UpperCamelCase_ )







def 					A       ( UpperCamelCase_   :       int )   ->    int:







			'''simple docstring'''



			lowerCAmelCase__									=							n
			for x in set(prime_factors(UpperCamelCase_ ) ):
						s *= (x - 1) / x
			return int(UpperCamelCase_ )


if __name__ == "__main__":
		import doctest

		doctest.testmod()





