
import os
import unittest

from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer

from ...test_tokenization_common import TokenizerTesterMixin
class 	A__   (						_A    ,						unittest.TestCase				):
							lowerCAmelCase__		:						Optional[Any]    			=							PhobertTokenizer
							lowerCAmelCase__		:						Any    			=							False





							def 			a__ ( self  :   Dict				)						->		List[Any]:



											"""simple docstring"""


											super().setUp()

											# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
											__lowercase								=					['''T@@''', '''i''', '''I''', '''R@@''', '''r''', '''e@@''']
											__lowercase								=					dict(zip(_UpperCAmelCase     , range(len(_UpperCAmelCase				)				)				)				)
											__lowercase								=					['''#version: 0.2''', '''l à</w>''']
											__lowercase								=					{'''unk_token''': '''<unk>'''}

											__lowercase								=					os.path.join(self.tmpdirname     , VOCAB_FILES_NAMES['vocab_file']				)
											__lowercase								=					os.path.join(self.tmpdirname     , VOCAB_FILES_NAMES['merges_file']				)

											with open(self.vocab_file     , 'w'     , encoding='utf-8'				) as fp:
															for token in vocab_tokens:
																			fp.write(f"""{token} {vocab_tokens[token]}\n"""				)
											with open(self.merges_file     , 'w'     , encoding='utf-8'				) as fp:
															fp.write('\n'.join(_UpperCAmelCase				)				)





							def 			a__ ( self  :   List[str]     , **_UpperCAmelCase  :   List[str]				)						->		Optional[int]:



											"""simple docstring"""


											kwargs.update(self.special_tokens_map				)
											return PhobertTokenizer.from_pretrained(self.tmpdirname     , **_UpperCAmelCase				)





							def 			a__ ( self  :   Optional[int]     , _UpperCAmelCase  :   Union[str, Any]				)						->		Optional[int]:



											"""simple docstring"""


											__lowercase								=					'''Tôi là VinAI Research'''
											__lowercase								=					'''T<unk> i <unk> <unk> <unk> <unk> <unk> <unk> I Re<unk> e<unk> <unk> <unk> <unk>'''
											return input_text, output_text





							def 			a__ ( self  :   Optional[int]				)						->		Optional[Any]:



											"""simple docstring"""


											__lowercase								=					PhobertTokenizer(self.vocab_file     , self.merges_file     , **self.special_tokens_map				)
											__lowercase								=					'''Tôi là VinAI Research'''
											__lowercase								=					'''T@@ ô@@ i l@@ à V@@ i@@ n@@ A@@ I R@@ e@@ s@@ e@@ a@@ r@@ c@@ h'''.split()
											__lowercase								=					tokenizer.tokenize(_UpperCAmelCase				)
											print(_UpperCAmelCase				)
											self.assertListEqual(_UpperCAmelCase     , _UpperCAmelCase				)

											__lowercase								=					tokens + [tokenizer.unk_token]

											__lowercase								=					[4, 3, 5, 3, 3, 3, 3, 3, 3, 6, 7, 9, 3, 9, 3, 3, 3, 3, 3]
											self.assertListEqual(tokenizer.convert_tokens_to_ids(_UpperCAmelCase				)     , _UpperCAmelCase				)













"""simple docstring"""



def 						lowercase    (				__snake_case				: int	):
		if not isinstance(__snake_case		,					__snake_case	):
				raise ValueError('''Input must be an integer'''	)
		if input_num <= 0:
				raise ValueError('''Input must be positive'''	)
		return sum(
		    divisor for divisor in range(1		,					input_num // 2 + 1	) if input_num % divisor == 0	)


if __name__ == "__main__":
						import doctest

						doctest.testmod()



