


'''simple docstring'''



import os
import unittest

from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer
from transformers.testing_utils import get_tests_dir

from ...test_tokenization_common import TokenizerTesterMixin


__A		=get_tests_dir('fixtures/test_sentencepiece_bpe.model')


class 						_snake_case   (       a__    ,				unittest.TestCase		):
					lowerCAmelCase :Dict						=   BartphoTokenizer
					lowerCAmelCase :int						=   False
					lowerCAmelCase :Any						=   True




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

								UpperCAmelCase__					:   List[str]       				=       ["""▁This""", """▁is""", """▁a""", """▁t""", """est"""]
								UpperCAmelCase__					:   Optional[int]       				=       dict(zip(_lowerCamelCase							,							range(len(_lowerCamelCase))))
								UpperCAmelCase__					:   List[Any]       				=       {"""unk_token""": """<unk>"""}

								UpperCAmelCase__					:   Optional[int]       				=       os.path.join(self.tmpdirname							,							VOCAB_FILES_NAMES["""monolingual_vocab_file"""])
								with open(self.monolingual_vocab_file							,							"""w"""							,							encoding="""utf-8""") as fp:
											for token in vocab_tokens:
														fp.write(f'''{token} {vocab_tokens[token]}\n''')

								UpperCAmelCase__					:   int       				=       BartphoTokenizer(_lowerCamelCase							,							self.monolingual_vocab_file							,							**self.special_tokens_map)
								tokenizer.save_pretrained(self.tmpdirname)




					def 			snake_case__  ( self							,							**_lowerCamelCase):
								kwargs.update(self.special_tokens_map)
								return BartphoTokenizer.from_pretrained(self.tmpdirname							,							**_lowerCamelCase)




					def 			snake_case__  ( self							,							_lowerCamelCase):
								UpperCAmelCase__					:   str       				=       """This is a là test"""
								UpperCAmelCase__					:   Optional[Any]       				=       """This is a<unk><unk> test"""
								return input_text, output_text




					def 			snake_case__  ( self):
								UpperCAmelCase__					:   Any       				=       BartphoTokenizer(_lowerCamelCase							,							self.monolingual_vocab_file							,							**self.special_tokens_map)
								UpperCAmelCase__					:   int       				=       """This is a là test"""
								UpperCAmelCase__					:   int       				=       """▁This ▁is ▁a ▁l à ▁t est""".split()
								UpperCAmelCase__					:   Dict       				=       tokenizer.tokenize(_lowerCamelCase)
								self.assertListEqual(_lowerCamelCase							,							_lowerCamelCase)

								UpperCAmelCase__					:   str       				=       tokens + [tokenizer.unk_token]
								UpperCAmelCase__					:   List[Any]       				=       [4, 5, 6, 3, 3, 7, 8, 3]
								self.assertListEqual(tokenizer.convert_tokens_to_ids(_lowerCamelCase)							,							_lowerCamelCase)



'''simple docstring'''



def       _UpperCamelCase (						UpperCamelCase__ = 1_0	, UpperCamelCase__ = 2_2   ):
			UpperCAmelCase__					:   List[str]       				=       range(1	, UpperCamelCase__   )
			UpperCAmelCase__					:   int       				=       range(1	, UpperCamelCase__   )
			return sum(
			    1 for power in powers for base in bases if len(str(base**power   )   ) == power   )


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