

"""simple docstring"""




import os
import unittest

from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer
from transformers.testing_utils import require_jieba, tooslow

from ...test_tokenization_common import TokenizerTesterMixin







@require_jieba
class 			lowercase    (	_UpperCAmelCase     ,  unittest.TestCase      ):
				__SCREAMING_SNAKE_CASE :			Any	      =      CpmAntTokenizer
				__SCREAMING_SNAKE_CASE :			Optional[Any]	      =      False




				def    a							( self	):
											super().setUp()

											snake_case_          =   [
											    """<d>""",
											    """</d>""",
											    """<s>""",
											    """</s>""",
											    """</_>""",
											    """<unk>""",
											    """<pad>""",
											    """</n>""",
											    """我""",
											    """是""",
											    """C""",
											    """P""",
											    """M""",
											    """A""",
											    """n""",
											    """t""",
											]
											snake_case_          =   os.path.join(self.tmpdirname				,       VOCAB_FILES_NAMES['vocab_file']	)
											with open(self.vocab_file				,       'w'				,       encoding='utf-8'	) as vocab_writer:
																		vocab_writer.write(''.join([x + '\n' for x in vocab_tokens]	)	)




				@tooslow
				def    a							( self	):
											snake_case_          =   CpmAntTokenizer.from_pretrained('openbmb/cpm-ant-10b'	)
											snake_case_          =   """今天天气真好！"""
											snake_case_          =   ["""今天""", """天气""", """真""", """好""", """！"""]
											snake_case_          =   tokenizer.tokenize(SCREAMING_SNAKE_CASE_	)
											self.assertListEqual(SCREAMING_SNAKE_CASE_				,       SCREAMING_SNAKE_CASE_	)
											snake_case_          =   """今天天气真好！"""
											snake_case_          =   [tokenizer.bos_token] + tokens

											snake_case_          =   [6, 9802, 1_4962, 2082, 831, 244]
											self.assertListEqual(tokenizer.convert_tokens_to_ids(SCREAMING_SNAKE_CASE_	)				,       SCREAMING_SNAKE_CASE_	)

											snake_case_          =   tokenizer.decode(SCREAMING_SNAKE_CASE_	)
											self.assertEqual(SCREAMING_SNAKE_CASE_				,       SCREAMING_SNAKE_CASE_	)







from __future__ import annotations





def  __lowerCamelCase     (			UpperCamelCase__       ,							UpperCamelCase__				):







							'''simple docstring'''






							snake_case_          =   []
							create_all_state(1       ,							UpperCamelCase__       ,							UpperCamelCase__       ,							[]       ,							UpperCamelCase__				)
							return result





def  __lowerCamelCase     (			UpperCamelCase__       ,							UpperCamelCase__       ,							UpperCamelCase__       ,							UpperCamelCase__       ,							UpperCamelCase__       ,							):







							'''simple docstring'''






							if level == 0:
														total_list.append(current_list[:]				)
														return

							for i in range(UpperCamelCase__       ,							total_number - level + 2				):
														current_list.append(UpperCamelCase__				)
														create_all_state(i + 1       ,							UpperCamelCase__       ,							level - 1       ,							UpperCamelCase__       ,							UpperCamelCase__				)
														current_list.pop()





def  __lowerCamelCase     (			UpperCamelCase__				):







							'''simple docstring'''






							for i in total_list:
														print(*UpperCamelCase__				)


if __name__ == "__main__":
					_UpperCAmelCase		:       str						    =	4
					_UpperCAmelCase		:       Tuple						    =	2
					_UpperCAmelCase		:       Optional[int]						    =	generate_all_combinations(n, k)
					print_all_state(total_list)




