






'''simple docstring'''
import os
import unittest

from transformers.models.bertweet.tokenization_bertweet import VOCAB_FILES_NAMES, BertweetTokenizer

from ...test_tokenization_common import TokenizerTesterMixin


class    _snake_case   (				_SCREAMING_SNAKE_CASE     ,					unittest.TestCase					):

					"""simple docstring"""





					_UpperCamelCase		 =      BertweetTokenizer
					_UpperCamelCase		 =      False




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

										# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
										a_									=   ['I', 'm', 'V@@', 'R@@', 'r', 'e@@']
										a_									=   dict(zip(__A   , range(len(__A     )     )     )     )
										a_									=   ['#version: 0.2', 'a m</w>']
										a_									=   {'unk_token': '<unk>'}

										a_									=   os.path.join(self.tmpdirname   , VOCAB_FILES_NAMES['vocab_file']     )
										a_									=   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(__A     )     )




					def  __SCREAMING_SNAKE_CASE (     self   , **UpperCAmelCase__     ):
										kwargs.update(self.special_tokens_map     )
										return BertweetTokenizer.from_pretrained(self.tmpdirname   , **__A     )




					def  __SCREAMING_SNAKE_CASE (     self   , UpperCAmelCase__     ):
										a_									=   'I am VinAI Research'
										a_									=   'I <unk> m V<unk> <unk> <unk> I Re<unk> e<unk> <unk> <unk> <unk>'
										return input_text, output_text




					def  __SCREAMING_SNAKE_CASE (     self     ):
										a_									=   BertweetTokenizer(self.vocab_file   , self.merges_file   , **self.special_tokens_map     )
										a_									=   'I am VinAI Research'
										a_									=   'I a@@ m V@@ i@@ n@@ A@@ I R@@ e@@ s@@ e@@ a@@ r@@ c@@ h'.split()
										a_									=   tokenizer.tokenize(__A     )
										self.assertListEqual(__A   , __A     )

										a_									=   tokens + [tokenizer.unk_token]

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









'''simple docstring'''
def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 9 / 5) + 3_2					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(float(_UpperCAmelCase ) + 2_7_3.1_5					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 9 / 5) + 4_9_1.6_7					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) - 3_2) * 5 / 9					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(((float(_UpperCAmelCase ) - 3_2) * 5 / 9) + 2_7_3.1_5					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(float(_UpperCAmelCase ) + 4_5_9.6_7					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(float(_UpperCAmelCase ) - 2_7_3.1_5					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(((float(_UpperCAmelCase ) - 2_7_3.1_5) * 9 / 5) + 3_2					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 9 / 5)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) - 4_9_1.6_7) * 5 / 9					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round(float(_UpperCAmelCase ) - 4_5_9.6_7					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 5 / 9)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 1.2_5 + 2_7_3.1_5)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 2.2_5 + 3_2)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 1.2_5)					,  _UpperCAmelCase )

def 							a	(   _UpperCAmelCase					,  _UpperCAmelCase = 2 )				->				float:






					"""simple docstring"""







					return round((float(_UpperCAmelCase ) * 2.2_5 + 3_2 + 4_5_9.6_7)					,  _UpperCAmelCase )


if __name__ == "__main__":
						import doctest

						doctest.testmod()

