



"""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      UpperCAmelCase_  (    _UpperCamelCase	,      unittest.TestCase						):
      __SCREAMING_SNAKE_CASE						:       Optional[int]								=			CpmAntTokenizer
      __SCREAMING_SNAKE_CASE						:       List[Any]								=			False



      def 						snake_case_ (					self					:     Optional[Any]						):
           super().setUp()

           _UpperCAmelCase      :     Dict        =   [
               "<d>",
               "</d>",
               "<s>",
               "</s>",
               "</_>",
               "<unk>",
               "<pad>",
               "</n>",
               "我",
               "是",
               "C",
               "P",
               "M",
               "A",
               "n",
               "t",
           ]
           _UpperCAmelCase      :     Tuple        =   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 						snake_case_ (					self					:     int						):
           _UpperCAmelCase      :     Any        =   CpmAntTokenizer.from_pretrained("openbmb/cpm-ant-10b"						)
           _UpperCAmelCase      :     Any        =   "今天天气真好！"
           _UpperCAmelCase      :     int        =   ["今天", "天气", "真", "好", "！"]
           _UpperCAmelCase      :     int        =   tokenizer.tokenize(A						)
           self.assertListEqual(A					,     A						)
           _UpperCAmelCase      :     Optional[Any]        =   "今天天气真好！"
           _UpperCAmelCase      :     List[str]        =   [tokenizer.bos_token] + tokens

           _UpperCAmelCase      :     Any        =   [6, 9_8_0_2, 1_4_9_6_2, 2_0_8_2, 8_3_1, 2_4_4]
           self.assertListEqual(tokenizer.convert_tokens_to_ids(A						)					,     A						)

           _UpperCAmelCase      :     str        =   tokenizer.decode(A						)
           self.assertEqual(A					,     A						)





"""simple docstring"""




from __future__ import annotations

from typing import Any

def 						__snake_case						(				SCREAMING_SNAKE_CASE__     :						list[Any]    )  ->       None:





     '''simple docstring'''

     create_state_space_tree(SCREAMING_SNAKE_CASE__						,  []						,  0    )

def 						__snake_case						(				SCREAMING_SNAKE_CASE__     :						list[Any]						,  SCREAMING_SNAKE_CASE__     :						list[Any]						,  SCREAMING_SNAKE_CASE__     :						int    )  ->       None:





     '''simple docstring'''

     if index == len(SCREAMING_SNAKE_CASE__    ):
          print(SCREAMING_SNAKE_CASE__    )
          return

     create_state_space_tree(SCREAMING_SNAKE_CASE__						,  SCREAMING_SNAKE_CASE__						,  index + 1    )
     current_subsequence.append(sequence[index]    )
     create_state_space_tree(SCREAMING_SNAKE_CASE__						,  SCREAMING_SNAKE_CASE__						,  index + 1    )
     current_subsequence.pop()


if __name__ == "__main__":
 _lowerCAmelCase    : list[Any]							=							[3, 1, 2, 4]
 generate_all_subsequences(seq)

 seq.clear()
 seq.extend(["A", "B", "C"])
 generate_all_subsequences(seq)
