





import unittest

from transformers import AlbertTokenizer, AlbertTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin


_UpperCAmelCase				:       Dict	   =				get_tests_dir("""fixtures/spiece.model""")

@require_sentencepiece
@require_tokenizers
class    lowerCAmelCase							(					__SCREAMING_SNAKE_CASE,  unittest.TestCase			):
 UpperCAmelCase__													=		AlbertTokenizer
 UpperCAmelCase__													=		AlbertTokenizerFast
 UpperCAmelCase__													=		True
 UpperCAmelCase__													=		True
 UpperCAmelCase__													=		True
 def      A_	(      self  :      Union[str, Any]	)			->	Any:
     super().setUp()

     # We have a SentencePiece fixture for testing
     lowerCamelCase__    :      int					 =		AlbertTokenizer(UpperCAmelCase	)
     tokenizer.save_pretrained(self.tmpdirname	)
 def      A_	(      self  :      Tuple			,     UpperCAmelCase  :      List[str]	)			->	Dict:
     lowerCamelCase__    :      Optional[int]					 =		'this is a test'
     lowerCamelCase__    :      Tuple					 =		'this is a test'
     return input_text, output_text
 def      A_	(      self  :      List[Any]	)			->	Dict:
     lowerCamelCase__    :      Optional[int]					 =		'<pad>'
     lowerCamelCase__    :      Any					 =		0

     self.assertEqual(self.get_tokenizer()._convert_token_to_id(UpperCAmelCase	)			,     UpperCAmelCase	)
     self.assertEqual(self.get_tokenizer()._convert_id_to_token(UpperCAmelCase	)			,     UpperCAmelCase	)
 def      A_	(      self  :      Optional[Any]	)			->	Optional[Any]:
     lowerCamelCase__    :      int					 =		list(self.get_tokenizer().get_vocab().keys()	)

     self.assertEqual(vocab_keys[0]			,     '<pad>'	)
     self.assertEqual(vocab_keys[1]			,     '<unk>'	)
     self.assertEqual(vocab_keys[-1]			,     '▁eloquent'	)
     self.assertEqual(len(UpperCAmelCase	)			,     30000	)
 def      A_	(      self  :      str	)			->	List[Any]:
     self.assertEqual(self.get_tokenizer().vocab_size			,     30000	)
 def      A_	(      self  :      str	)			->	str:
     if not self.test_rust_tokenizer:
         return

     lowerCamelCase__    :      List[Any]					 =		self.get_tokenizer()
     lowerCamelCase__    :      Tuple					 =		self.get_rust_tokenizer()

     lowerCamelCase__    :      Union[str, Any]					 =		'I was born in 92000, and this is falsé.'

     lowerCamelCase__    :      Dict					 =		tokenizer.tokenize(UpperCAmelCase	)
     lowerCamelCase__    :      Tuple					 =		rust_tokenizer.tokenize(UpperCAmelCase	)
     self.assertListEqual(UpperCAmelCase			,     UpperCAmelCase	)

     lowerCamelCase__    :      Union[str, Any]					 =		tokenizer.encode(UpperCAmelCase			,     add_special_tokens=UpperCAmelCase	)
     lowerCamelCase__    :      Optional[int]					 =		rust_tokenizer.encode(UpperCAmelCase			,     add_special_tokens=UpperCAmelCase	)
     self.assertListEqual(UpperCAmelCase			,     UpperCAmelCase	)

     lowerCamelCase__    :      List[Any]					 =		self.get_rust_tokenizer()
     lowerCamelCase__    :      Optional[int]					 =		tokenizer.encode(UpperCAmelCase	)
     lowerCamelCase__    :      Optional[int]					 =		rust_tokenizer.encode(UpperCAmelCase	)
     self.assertListEqual(UpperCAmelCase			,     UpperCAmelCase	)
 def      A_	(      self  :      Any	)			->	Optional[int]:
     lowerCamelCase__    :      List[Any]					 =		AlbertTokenizer(UpperCAmelCase			,     keep_accents=UpperCAmelCase	)

     lowerCamelCase__    :      List[str]					 =		tokenizer.tokenize('This is a test'	)
     self.assertListEqual(UpperCAmelCase			,     ['▁this', '▁is', '▁a', '▁test']	)

     self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCAmelCase	)			,     [48, 25, 21, 1289]	)

     lowerCamelCase__    :      List[str]					 =		tokenizer.tokenize('I was born in 92000, and this is falsé.'	)
     self.assertListEqual(
         UpperCAmelCase			,     ['▁i', '▁was', '▁born', '▁in', '▁9', '2000', ',', '▁and', '▁this', '▁is', '▁fal', 's', 'é', '.']	)
     lowerCamelCase__    :      List[Any]					 =		tokenizer.convert_tokens_to_ids(UpperCAmelCase	)
     self.assertListEqual(UpperCAmelCase			,     [31, 23, 386, 19, 561, 3050, 15, 17, 48, 25, 8256, 18, 1, 9]	)

     lowerCamelCase__    :      Any					 =		tokenizer.convert_ids_to_tokens(UpperCAmelCase	)
     self.assertListEqual(
         UpperCAmelCase			,     ['▁i', '▁was', '▁born', '▁in', '▁9', '2000', ',', '▁and', '▁this', '▁is', '▁fal', 's', '<unk>', '.']			,     )
 def      A_	(      self  :      List[str]	)			->	Optional[Any]:
     lowerCamelCase__    :      str					 =		AlbertTokenizer(UpperCAmelCase	)

     lowerCamelCase__    :      Optional[Any]					 =		tokenizer.encode('sequence builders'	)
     lowerCamelCase__    :      List[Any]					 =		tokenizer.encode('multi-sequence build'	)

     lowerCamelCase__    :      List[str]					 =		tokenizer.build_inputs_with_special_tokens(UpperCAmelCase	)
     lowerCamelCase__    :      Union[str, Any]					 =		tokenizer.build_inputs_with_special_tokens(UpperCAmelCase			,     UpperCAmelCase	)

     assert encoded_sentence == [tokenizer.cls_token_id] + text + [tokenizer.sep_token_id]
     assert encoded_pair == [tokenizer.cls_token_id] + text + [tokenizer.sep_token_id] + text_a + [
         tokenizer.sep_token_id
     ]







 @slow
 def      A_	(      self  :      int	)			->	List[str]:
     # fmt: off
     lowerCamelCase__    :      Tuple					 =		{'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], 'input_ids': [[2, 21970, 13, 5, 6092, 167, 28, 7103, 2153, 673, 8, 7028, 12051, 18, 17, 7103, 2153, 673, 8, 3515, 18684, 8, 4461, 6, 1927, 297, 8, 12060, 2607, 18, 13, 5, 4461, 15, 10538, 38, 8, 135, 15, 822, 58, 15, 993, 10363, 15, 1460, 8005, 4461, 15, 993, 255, 2328, 9, 9, 9, 6, 26, 1112, 816, 3260, 13, 5, 103, 2377, 6, 17, 1112, 816, 2782, 13, 5, 103, 10641, 6, 29, 84, 2512, 2430, 782, 18684, 2761, 19, 808, 2430, 2556, 17, 855, 1480, 9477, 4091, 128, 11712, 15, 7103, 2153, 673, 17, 24883, 9990, 9, 3], [2, 11502, 25, 1006, 20, 782, 8, 11809, 855, 1732, 19393, 18667, 37, 367, 21018, 69, 1854, 34, 11860, 19124, 27, 156, 225, 17, 193, 4141, 19, 65, 9124, 9, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]}  # noqa: E501
     # fmt: on

     self.tokenizer_integration_test_util(
         expected_encoding=UpperCAmelCase			,     model_name='albert-base-v2'			,     revision='6b6560eaf5ff2e250b00c50f380c5389a9c2d82e'			,     )







def 						UpperCAmelCase			(	a_						)		->	list:







				"""simple docstring"""



				if len(a_						) <= 1:
								return [tuple(a_						)]

				__A   			= []

				def generate(a_		,   a_						):
								if k == 1:
												res.append(tuple(arr[:]						)						)
												return

								generate(k - 1		,   a_						)

								for i in range(k - 1						):
												if k % 2 == 0:  # k is even
																__A			,							__A   			= arr[k - 1], arr[i]
												else:  # k is odd
																__A			,							__A   			= arr[k - 1], arr[0]
												generate(k - 1		,   a_						)

				generate(len(a_						)		,   a_						)
				return res


if __name__ == "__main__":
					SCREAMING_SNAKE_CASE							:int							 =				input('Enter numbers separated by a comma:\n').strip()
					SCREAMING_SNAKE_CASE							:Dict							 =				[int(item) for item in user_input.split(',')]
					print(heaps(arr))
