



"""simple docstring"""






import os
import unittest

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

from ...test_tokenization_common import TokenizerTesterMixin






class 			__snake_case			(      _a    ,	unittest.TestCase):
  snake_case__							:  Optional[int]         =		PhobertTokenizer
  snake_case__							:  List[Any]         =		False




  def 		SCREAMING_SNAKE_CASE							(					self	:		Optional[int]						):






         """simple docstring"""






         super().setUp()

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

         _lowerCamelCase		:							List[str]            =					os.path.join(self.tmpdirname		,   VOCAB_FILES_NAMES['''vocab_file''']						)
         _lowerCamelCase		:							Union[str, Any]            =					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 		SCREAMING_SNAKE_CASE							(					self	:		List[Any]		,   **__lowerCAmelCase	:		Optional[Any]						):






         """simple docstring"""






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




  def 		SCREAMING_SNAKE_CASE							(					self	:		List[str]		,   __lowerCAmelCase	:		Tuple						):






         """simple docstring"""






         _lowerCamelCase		:							Optional[int]            =					'''Tôi là VinAI Research'''
         _lowerCamelCase		:							List[Any]            =					'''T<unk> i <unk> <unk> <unk> <unk> <unk> <unk> I Re<unk> e<unk> <unk> <unk> <unk>'''
         return input_text, output_text




  def 		SCREAMING_SNAKE_CASE							(					self	:		Any						):






         """simple docstring"""






         _lowerCamelCase		:							Dict            =					PhobertTokenizer(self.vocab_file		,   self.merges_file		,   **self.special_tokens_map						)
         _lowerCamelCase		:							Any            =					'''Tôi là VinAI Research'''
         _lowerCamelCase		:							Optional[Any]            =					'''T@@ ô@@ i l@@ à V@@ i@@ n@@ A@@ I R@@ e@@ s@@ e@@ a@@ r@@ c@@ h'''.split()
         _lowerCamelCase		:							int            =					tokenizer.tokenize(__UpperCamelCase						)
         print(__UpperCamelCase						)
         self.assertListEqual(__UpperCamelCase		,   __UpperCamelCase						)

         _lowerCamelCase		:							int            =					tokens + [tokenizer.unk_token]

         _lowerCamelCase		:							Any            =					[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						)




import os

# Precomputes a list of the 100 first triangular numbers
A		: List[Any]								=     [int(0.5 * n * (n + 1)) for n in range(1, 101)]




def 	UpperCamelCase__  (     )  ->     str:
						_lowercase					       =					os.path.dirname(os.path.realpath(SCREAMING_SNAKE_CASE_       )       )
						_lowercase					       =					os.path.join(SCREAMING_SNAKE_CASE_		,   """words.txt"""       )

						_lowercase					       =					""""""
						with open(SCREAMING_SNAKE_CASE_       ) as f:
												_lowercase					       =					f.readline()

						_lowercase					       =					[word.strip("""\""""       ) for word in words.strip("""\r\n"""       ).split(""","""       )]
						_lowercase					       =					[
						    word
						    for word in [sum(ord(SCREAMING_SNAKE_CASE_       ) - 64 for x in word       ) for word in words]
						    if word in TRIANGULAR_NUMBERS
						]
						return len(SCREAMING_SNAKE_CASE_       )


if __name__ == "__main__":
		print(solution())