





"""simple docstring"""





import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
  from .tokenization_xlnet import XLNetTokenizer
else:
  __A											=		None


__A											=		logging.get_logger(__name__)

__A											=		{"""vocab_file""": """spiece.model""", """tokenizer_file""": """tokenizer.json"""}

__A											=		{
    """vocab_file""": {
        """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/spiece.model""",
        """xlnet-large-cased""": """https://huggingface.co/xlnet-large-cased/resolve/main/spiece.model""",
    },
    """tokenizer_file""": {
        """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/tokenizer.json""",
        """xlnet-large-cased""": """https://huggingface.co/xlnet-large-cased/resolve/main/tokenizer.json""",
    },
}

__A											=		{
    """xlnet-base-cased""": None,
    """xlnet-large-cased""": None,
}

__A											=		"""▁"""

# Segments (not really needed)
__A											=		0
__A											=		1
__A											=		2
__A											=		3
__A											=		4






class 					_lowerCAmelCase   (     a       ):
       """simple docstring"""




       __magic_name__     :Optional[Any]		  =					VOCAB_FILES_NAMES
       __magic_name__     :Union[str, Any]		  =					PRETRAINED_VOCAB_FILES_MAP
       __magic_name__     :Union[str, Any]		  =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       __magic_name__     :int		  =					"""left"""
       __magic_name__     :Optional[int]		  =					XLNetTokenizer






       def __init__(    self    , __UpperCAmelCase=None    , __UpperCAmelCase=None    , __UpperCAmelCase=False    , __UpperCAmelCase=True    , __UpperCAmelCase=False    , __UpperCAmelCase="<s>"    , __UpperCAmelCase="</s>"    , __UpperCAmelCase="<unk>"    , __UpperCAmelCase="<sep>"    , __UpperCAmelCase="<pad>"    , __UpperCAmelCase="<cls>"    , __UpperCAmelCase="<mask>"    , __UpperCAmelCase=["<eop>", "<eod>"]    , **__UpperCAmelCase    , ):



         '''simple docstring'''

         lowerCAmelCase__			:Optional[int]											=							AddedToken(__UpperCAmelCase    , lstrip=__UpperCAmelCase    , rstrip=__UpperCAmelCase      ) if isinstance(__UpperCAmelCase    , __UpperCAmelCase      ) else mask_token

         super().__init__(
             vocab_file=__UpperCAmelCase    , tokenizer_file=__UpperCAmelCase    , do_lower_case=__UpperCAmelCase    , remove_space=__UpperCAmelCase    , keep_accents=__UpperCAmelCase    , bos_token=__UpperCAmelCase    , eos_token=__UpperCAmelCase    , unk_token=__UpperCAmelCase    , sep_token=__UpperCAmelCase    , pad_token=__UpperCAmelCase    , cls_token=__UpperCAmelCase    , mask_token=__UpperCAmelCase    , additional_special_tokens=__UpperCAmelCase    , **__UpperCAmelCase    , )

         lowerCAmelCase__			:Optional[Any]											=							3
         lowerCAmelCase__			:Dict											=							do_lower_case
         lowerCAmelCase__			:Optional[Any]											=							remove_space
         lowerCAmelCase__			:Union[str, Any]											=							keep_accents
         lowerCAmelCase__			:Optional[Any]											=							vocab_file
         lowerCAmelCase__			:List[str]											=							False if not self.vocab_file else True






       def      snake_case						(    self    , __UpperCAmelCase    , __UpperCAmelCase = None      ):



         '''simple docstring'''

         lowerCAmelCase__			:Optional[int]											=							[self.sep_token_id]
         lowerCAmelCase__			:Optional[int]											=							[self.cls_token_id]
         if token_ids_a is None:
           return token_ids_a + sep + cls
         return token_ids_a + sep + token_ids_a + sep + cls






       def      snake_case						(    self    , __UpperCAmelCase    , __UpperCAmelCase = None      ):



         '''simple docstring'''

         lowerCAmelCase__			:str											=							[self.sep_token_id]
         lowerCAmelCase__			:List[str]											=							[2]

         if token_ids_a is None:
           return len(token_ids_a + sep      ) * [0] + cls_segment_id
         return len(token_ids_a + sep      ) * [0] + len(token_ids_a + sep      ) * [1] + cls_segment_id






       def      snake_case						(    self    , __UpperCAmelCase    , __UpperCAmelCase = None      ):



         '''simple docstring'''

         if not self.can_save_slow_tokenizer:
           raise ValueError(
               'Your fast tokenizer does not have the necessary information to save the vocabulary for a slow '
               'tokenizer.'      )

         if not os.path.isdir(__UpperCAmelCase      ):
           logger.error(F"Vocabulary path ({save_directory}) should be a directory"      )
           return
         lowerCAmelCase__			:List[str]											=							os.path.join(
             __UpperCAmelCase    , (filename_prefix + '-' if filename_prefix else '') + VOCAB_FILES_NAMES['vocab_file']      )

         if os.path.abspath(self.vocab_file      ) != os.path.abspath(__UpperCAmelCase      ):
           copyfile(self.vocab_file    , __UpperCAmelCase      )

         return (out_vocab_file,)







"""simple docstring"""





import math
def  __A   (_SCREAMING_SNAKE_CASE			)					->int:





  """simple docstring"""


  if not isinstance(_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			):
    lowerCAmelCase__			:Dict											=							F"Input value of [number={number}] must be an integer"
    raise TypeError(_SCREAMING_SNAKE_CASE			)

  if number < 1:
    lowerCAmelCase__			:Dict											=							F"Input value of [number={number}] must be > 0"
    raise ValueError(_SCREAMING_SNAKE_CASE			)
  elif number == 1:
    return 3
  elif number == 2:
    return 5
  else:
    lowerCAmelCase__			:Union[str, Any]											=							int(math.log(number // 3     ,   2			)			) + 2

    lowerCAmelCase__			:Optional[Any]											=							[3, 5]
    lowerCAmelCase__			:Optional[Any]											=							2
    lowerCAmelCase__			:List[str]											=							3
    for block in range(1     ,   _SCREAMING_SNAKE_CASE			):
      for _ in range(_SCREAMING_SNAKE_CASE			):
        proth_list.append(2 ** (block + 1) + proth_list[proth_index - 1]			)
        proth_index += 1
      increment *= 2

  return proth_list[number - 1]


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  for number in range(11):
    __A											=		0
    try:
      __A											=		proth(number)
    except ValueError:
      print(F'''ValueError: there is no {number}th Proth number''')
      continue

    print(F'''The {number}th Proth number: {value}''')
