




import copy
import random

from transformers import CLIPTokenizer







class        UpperCamelCase__   (	__magic_name__   ):

					def __init__(     self       :   Any							,					*UpperCamelCase__       :   Optional[int]							,					**UpperCamelCase__       :   List[str]       ):






										'''simple docstring'''






										super().__init__(*UpperCamelCase__							,					**UpperCamelCase__       )
										lowercase_  							=			{}

					def   UpperCAmelCase__       (     self       :   Dict							,					UpperCamelCase__       :   Optional[Any]							,					*UpperCamelCase__       :   Union[str, Any]							,					**UpperCamelCase__       :   str       ):






										'''simple docstring'''






										lowercase_  							=			super().add_tokens(UpperCamelCase__							,					*UpperCamelCase__							,					**UpperCamelCase__       )
										if num_added_tokens == 0:
															raise ValueError(
															    F'''The tokenizer already contains the token {placeholder_token}. Please pass a different'''
															    """ `placeholder_token` that is not already in the tokenizer."""       )

					def   UpperCAmelCase__       (     self       :   Any							,					UpperCamelCase__       :   Optional[Any]							,					*UpperCamelCase__       :   str							,					UpperCamelCase__       :   Optional[int]=1							,					**UpperCamelCase__       :   int       ):






										'''simple docstring'''






										lowercase_  							=			[]
										if num_vec_per_token == 1:
															self.try_adding_tokens(UpperCamelCase__							,					*UpperCamelCase__							,					**UpperCamelCase__       )
															output.append(UpperCamelCase__       )
										else:
															lowercase_  							=			[]
															for i in range(UpperCamelCase__       ):
																				lowercase_  							=			placeholder_token + F'''_{i}'''
																				self.try_adding_tokens(UpperCamelCase__							,					*UpperCamelCase__							,					**UpperCamelCase__       )
																				output.append(UpperCamelCase__       )
        # handle cases where there is a new placeholder token that contains the current placeholder token but is larger
										for token in self.token_map:
															if token in placeholder_token:
																				raise ValueError(
																				    F'''The tokenizer already has placeholder token {token} that can get confused with'''
																				    F''' {placeholder_token}keep placeholder tokens independent'''       )
										lowercase_  							=			output

					def   UpperCAmelCase__       (     self       :   Union[str, Any]							,					UpperCamelCase__       :   Tuple							,					UpperCamelCase__       :   Tuple=False							,					UpperCamelCase__       :   Tuple=1.0       ):






										'''simple docstring'''






										if isinstance(UpperCamelCase__							,					UpperCamelCase__       ):
															lowercase_  							=			[]
															for i in range(len(UpperCamelCase__       )       ):
																				output.append(self.replace_placeholder_tokens_in_text(text[i]							,					vector_shuffle=UpperCamelCase__       )       )
															return output
										for placeholder_token in self.token_map:
															if placeholder_token in text:
																				lowercase_  							=			self.token_map[placeholder_token]
																				lowercase_  							=			tokens[: 1 + int(len(UpperCamelCase__       ) * prop_tokens_to_load       )]
																				if vector_shuffle:
																									lowercase_  							=			copy.copy(UpperCamelCase__       )
																									random.shuffle(UpperCamelCase__       )
																				lowercase_  							=			text.replace(UpperCamelCase__							,					""" """.join(UpperCamelCase__       )       )
										return text

					def __call__(     self       :   Union[str, Any]							,					UpperCamelCase__       :   Optional[int]							,					*UpperCamelCase__       :   Any							,					UpperCamelCase__       :   int=False							,					UpperCamelCase__       :   List[str]=1.0							,					**UpperCamelCase__       :   List[str]       ):






										'''simple docstring'''






										return super().__call__(
										    self.replace_placeholder_tokens_in_text(
										        UpperCamelCase__							,					vector_shuffle=UpperCamelCase__							,					prop_tokens_to_load=UpperCamelCase__       )							,					*UpperCamelCase__							,					**UpperCamelCase__							,					)







					def   UpperCAmelCase__       (     self       :   List[Any]							,					UpperCamelCase__       :   List[Any]							,					*UpperCamelCase__       :   Tuple							,					UpperCamelCase__       :   Any=False							,					UpperCamelCase__       :   int=1.0							,					**UpperCamelCase__       :   int       ):






										'''simple docstring'''






										return super().encode(
										    self.replace_placeholder_tokens_in_text(
										        UpperCamelCase__							,					vector_shuffle=UpperCamelCase__							,					prop_tokens_to_load=UpperCamelCase__       )							,					*UpperCamelCase__							,					**UpperCamelCase__							,					)






def 			UpperCAmelCase_				(      UpperCAmelCase__  ):
					return " ".join(input_str.split()[::-1]  )


if __name__ == "__main__":
							import doctest

							doctest.testmod()


