




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


lowerCamelCase_  						=   logging.get_logger(__name__)

lowerCamelCase_  						=   {"vocab_file": "vocab.txt"}

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

lowerCamelCase_  						=   {
    "tau/splinter-base": 512,
    "tau/splinter-base-qass": 512,
    "tau/splinter-large": 512,
    "tau/splinter-large-qass": 512,
}

lowerCamelCase_  						=   {
    "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					( __lowerCamelCase     ):


     """simple docstring"""


     _A				:    int									=  VOCAB_FILES_NAMES
     _A				:    Union[str, Any]									=  PRETRAINED_VOCAB_FILES_MAP
     _A				:    Any									=  PRETRAINED_INIT_CONFIGURATION
     _A				:    Optional[int]									=  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     _A				:    Dict									=  SplinterTokenizer




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

         SCREAMING_SNAKE_CASE__								=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
         ):
             SCREAMING_SNAKE_CASE__								=getattr(_UpperCamelCase				,pre_tok_state.pop("""type"""						)						)
             SCREAMING_SNAKE_CASE__								=do_lower_case
             SCREAMING_SNAKE_CASE__								=strip_accents
             SCREAMING_SNAKE_CASE__								=pre_tok_class(**_UpperCamelCase						)

         SCREAMING_SNAKE_CASE__								=do_lower_case




     @property
     def   __A				(	self			: Union[str, Any]						)		->   Optional[Any]:


         '''simple docstring'''





         return self.convert_tokens_to_ids(self.question_token						)




     def   __A				(	self			: str				,_UpperCamelCase			: List[int]				,_UpperCamelCase			: Optional[List[int]] = None						)		->   List[int]:


         '''simple docstring'''





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

         SCREAMING_SNAKE_CASE__								=[self.cls_token_id]
         SCREAMING_SNAKE_CASE__								=[self.sep_token_id]
         SCREAMING_SNAKE_CASE__								=[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   __A				(	self			: Any				,_UpperCamelCase			: List[int]				,_UpperCamelCase			: Optional[List[int]] = None						)		->   List[int]:


         '''simple docstring'''





         SCREAMING_SNAKE_CASE__								=[self.sep_token_id]
         SCREAMING_SNAKE_CASE__								=[self.cls_token_id]
         SCREAMING_SNAKE_CASE__								=[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   __A				(	self			: Any				,_UpperCamelCase			: str				,_UpperCamelCase			: Optional[str] = None						)		->   Tuple[str]:


         '''simple docstring'''





         SCREAMING_SNAKE_CASE__								=self._tokenizer.model.save(_UpperCamelCase				,name=_UpperCamelCase						)
         return tuple(_UpperCamelCase						)












def 	UpperCAmelCase_    (	__UpperCamelCase	):
    if not isinstance(__UpperCamelCase,				__UpperCamelCase	):
        raise ValueError("""double_factorial() only accepts integral values"""	)
    if n < 0:
        raise ValueError("""double_factorial() not defined for negative values"""	)
    return 1 if n <= 1 else n * double_factorial(n - 2	)


if __name__ == "__main__":
    import doctest

    doctest.testmod()






