






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


A_     =				logging.get_logger(__name__)

A_     =				{'''vocab_file''': '''vocab.txt'''}

A_     =				{
    '''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''',
    }
}

A_     =				{
    '''tau/splinter-base''': 512,
    '''tau/splinter-base-qass''': 512,
    '''tau/splinter-large''': 512,
    '''tau/splinter-large-qass''': 512,
}

A_     =				{
    '''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 				__SCREAMING_SNAKE_CASE    (					UpperCamelCase		):
							snake_case_  =				VOCAB_FILES_NAMES
							snake_case_  =				PRETRAINED_VOCAB_FILES_MAP
							snake_case_  =				PRETRAINED_INIT_CONFIGURATION
							snake_case_  =				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							snake_case_  =				SplinterTokenizer


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





													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      ,     additional_special_tokens=(question_token,)      ,     **snake_case      ,     )

													A__    :	List[str]			=	json.loads(self.backend_tokenizer.normalizer.__getstate__()				)
													if (
													    pre_tok_state.get("""lowercase"""      ,     snake_case				) != do_lower_case
													    or pre_tok_state.get("""strip_accents"""      ,     snake_case				) != strip_accents
													):
																			A__    :	List[str]			=	getattr(snake_case      ,     pre_tok_state.pop("""type"""				)				)
																			A__    :	List[Any]			=	do_lower_case
																			A__    :	Optional[int]			=	strip_accents
																			A__    :	Any			=	pre_tok_class(**snake_case				)

													A__    :	Tuple			=	do_lower_case


							@property
							def     _UpperCamelCase							(      self   :    Dict				):
													'''simple docstring'''





													return self.convert_tokens_to_ids(self.question_token				)


							def     _UpperCamelCase							(      self   :    Optional[Any]      ,     snake_case   :    List[int]      ,     snake_case   :    Optional[List[int]] = None				):
													'''simple docstring'''





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

													A__    :	List[str]			=	[self.cls_token_id]
													A__    :	List[Any]			=	[self.sep_token_id]
													A__    :	List[Any]			=	[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     _UpperCamelCase							(      self   :    Dict      ,     snake_case   :    List[int]      ,     snake_case   :    Optional[List[int]] = None				):
													'''simple docstring'''





													A__    :	str			=	[self.sep_token_id]
													A__    :	str			=	[self.cls_token_id]
													A__    :	Tuple			=	[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     _UpperCamelCase							(      self   :    List[str]      ,     snake_case   :    str      ,     snake_case   :    Optional[str] = None				):
													'''simple docstring'''





													A__    :	List[Any]			=	self._tokenizer.model.save(snake_case      ,     name=snake_case				)
													return tuple(snake_case				)














"""simple docstring"""



def   _lowerCAmelCase		(				UpperCAmelCase__							:       float,    UpperCAmelCase__							:       float,    UpperCAmelCase__							:       float   )		->list[int]:
						if hue < 0 or hue > 3_6_0:
												raise Exception("""hue should be between 0 and 360"""   )

						if saturation < 0 or saturation > 1:
												raise Exception("""saturation should be between 0 and 1"""   )

						if value < 0 or value > 1:
												raise Exception("""value should be between 0 and 1"""   )

						A__    :	int			=	value * saturation
						A__    :	Any			=	hue / 6_0
						A__    :	Any			=	chroma * (1 - abs(hue_section % 2 - 1   ))
						A__    :	Optional[Any]			=	value - chroma

						if hue_section >= 0 and hue_section <= 1:
												A__    :	Dict			=	round(2_5_5 * (chroma + match_value)   )
												A__    :	Optional[Any]			=	round(2_5_5 * (second_largest_component + match_value)   )
												A__    :	Any			=	round(2_5_5 * (match_value)   )
						elif hue_section > 1 and hue_section <= 2:
												A__    :	Optional[int]			=	round(2_5_5 * (second_largest_component + match_value)   )
												A__    :	Union[str, Any]			=	round(2_5_5 * (chroma + match_value)   )
												A__    :	Union[str, Any]			=	round(2_5_5 * (match_value)   )
						elif hue_section > 2 and hue_section <= 3:
												A__    :	Tuple			=	round(2_5_5 * (match_value)   )
												A__    :	List[str]			=	round(2_5_5 * (chroma + match_value)   )
												A__    :	Union[str, Any]			=	round(2_5_5 * (second_largest_component + match_value)   )
						elif hue_section > 3 and hue_section <= 4:
												A__    :	Any			=	round(2_5_5 * (match_value)   )
												A__    :	Dict			=	round(2_5_5 * (second_largest_component + match_value)   )
												A__    :	List[Any]			=	round(2_5_5 * (chroma + match_value)   )
						elif hue_section > 4 and hue_section <= 5:
												A__    :	Any			=	round(2_5_5 * (second_largest_component + match_value)   )
												A__    :	Dict			=	round(2_5_5 * (match_value)   )
												A__    :	Tuple			=	round(2_5_5 * (chroma + match_value)   )
						else:
												A__    :	Tuple			=	round(2_5_5 * (chroma + match_value)   )
												A__    :	Optional[int]			=	round(2_5_5 * (match_value)   )
												A__    :	str			=	round(2_5_5 * (second_largest_component + match_value)   )

						return [red, green, blue]




def   _lowerCAmelCase		(				UpperCAmelCase__							:       int,    UpperCAmelCase__							:       int,    UpperCAmelCase__							:       int   )		->list[float]:
						if red < 0 or red > 2_5_5:
												raise Exception("""red should be between 0 and 255"""   )

						if green < 0 or green > 2_5_5:
												raise Exception("""green should be between 0 and 255"""   )

						if blue < 0 or blue > 2_5_5:
												raise Exception("""blue should be between 0 and 255"""   )

						A__    :	int			=	red / 2_5_5
						A__    :	List[str]			=	green / 2_5_5
						A__    :	Optional[int]			=	blue / 2_5_5
						A__    :	Optional[int]			=	max(UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__   )
						A__    :	Tuple			=	value - min(UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__   )
						A__    :	Any			=	0 if value == 0 else chroma / value

						if chroma == 0:
												A__    :	Optional[Any]			=	0.0
						elif value == float_red:
												A__    :	Optional[Any]			=	6_0 * (0 + (float_green - float_blue) / chroma)
						elif value == float_green:
												A__    :	Tuple			=	6_0 * (2 + (float_blue - float_red) / chroma)
						else:
												A__    :	int			=	6_0 * (4 + (float_red - float_green) / chroma)

						A__    :	Optional[int]			=	(hue + 3_6_0) % 3_6_0

						return [hue, saturation, value]




def   _lowerCAmelCase		(				UpperCAmelCase__							:       list[float],    UpperCAmelCase__							:       list[float]   )		->bool:
						A__    :	Optional[Any]			=	abs(hsv_a[0] - hsv_a[0]   ) < 0.2
						A__    :	str			=	abs(hsv_a[1] - hsv_a[1]   ) < 0.002
						A__    :	Optional[int]			=	abs(hsv_a[2] - hsv_a[2]   ) < 0.002

						return check_hue and check_saturation and check_value






