





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:
    __lowerCamelCase       :     Any   =     None


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

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

__lowerCamelCase       :     Tuple   =     {
    """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""",
    },
}

__lowerCamelCase       :     Optional[int]   =     {
    """xlnet-base-cased""": None,
    """xlnet-large-cased""": None,
}

__lowerCamelCase       :     Any   =     """▁"""

# Segments (not really needed)
__lowerCamelCase       :     Optional[Any]   =     0
__lowerCamelCase       :     Dict   =     1
__lowerCamelCase       :     Tuple   =     2
__lowerCamelCase       :     List[Any]   =     3
__lowerCamelCase       :     List[str]   =     4



class 					A__   (       __snake_case			):
      _UpperCAmelCase	:int						    =   VOCAB_FILES_NAMES
      _UpperCAmelCase	:Optional[int]						    =   PRETRAINED_VOCAB_FILES_MAP
      _UpperCAmelCase	:Dict						    =   PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      _UpperCAmelCase	:Optional[Any]						    =   'left'
      _UpperCAmelCase	:str						    =   XLNetTokenizer





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




       UpperCamelCase	:					Dict       	=   AddedToken(A_       ,							lstrip=A_       ,							rstrip=A_   ) if isinstance(A_       ,							A_   ) else mask_token

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

       UpperCamelCase	:					str       	=   3
       UpperCamelCase	:					str       	=   do_lower_case
       UpperCamelCase	:					Tuple       	=   remove_space
       UpperCamelCase	:					List[Any]       	=   keep_accents
       UpperCamelCase	:					Any       	=   vocab_file
       UpperCamelCase	:					int       	=   False if not self.vocab_file else True





      def        __UpperCamelCase( self       ,							A_       ,							A_ = None   ):
       '''simple docstring'''




       UpperCamelCase	:					Any       	=   [self.sep_token_id]
       UpperCamelCase	:					Optional[Any]       	=   [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        __UpperCamelCase( self       ,							A_       ,							A_ = None   ):
       '''simple docstring'''




       UpperCamelCase	:					List[Any]       	=   [self.sep_token_id]
       UpperCamelCase	:					Union[str, Any]       	=   [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        __UpperCamelCase( self       ,							A_       ,							A_ = 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(A_   ):
        logger.error(F"""Vocabulary path ({save_directory}) should be a directory"""   )
        return
       UpperCamelCase	:					Union[str, Any]       	=   os.path.join(
           A_       ,							(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]   )

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

       return (out_vocab_file,)







from __future__ import annotations

from functools import lru_cache
from math import ceil

__lowerCamelCase       :     str   =     100

__lowerCamelCase       :     Any   =     set(range(3, NUM_PRIMES, 2))
primes.add(2)
__lowerCamelCase       :     int

for prime in range(3, ceil(NUM_PRIMES**0.5), 2):
    if prime not in primes:
        continue
    primes.difference_update(set(range(prime * prime, NUM_PRIMES, prime)))



@lru_cache(maxsize=100     )
def 		A_				(     _lowerCAmelCase     )						-> set[int]:
 if number_to_partition < 0:
  return set()
 elif number_to_partition == 0:
  return {1}

 UpperCamelCase	:					set[int]       	=   set()
 UpperCamelCase	:					int
 UpperCamelCase	:					int

 for prime in primes:
  if prime > number_to_partition:
   continue
  for sub in partition(number_to_partition - prime     ):
   ret.add(sub * prime     )

 return ret



def 		A_				(     _lowerCAmelCase = 5000     )						-> int | None:
 for number_to_partition in range(1							,   _lowerCAmelCase     ):
  if len(partition(_lowerCAmelCase     )     ) > number_unique_partitions:
   return number_to_partition
 return None


if __name__ == "__main__":
    print(f"""{solution() = }""")
