code: import inspect
  import json
  import os
  import tempfile
  import unittest
  
  from transformers.models.speech_to_text_a import SpeechaTextaTokenizer
  from transformers.models.speech_to_text_a.tokenization_speech_to_text_a import VOCAB_FILES_NAMES
  
  from ...test_tokenization_common import TokenizerTesterMixin
  
  
  
  
  class    __lowerCAmelCase  (       lowercase__,	unittest.TestCase						):
  
  
  
   '''simple docstring'''
   _lowerCamelCase						:	Union[str, Any]				    = SpeechaTextaTokenizer
   _lowerCamelCase						:	Optional[Any]				    = False
  
   def 					__snake_case					(			self       :		Tuple  ) ->							List[Any]:
          super().setUp()
  
          _UpperCamelCase     :       str  						=  '<s> <pad> </s> <unk> here@@ a couple of@@ words for the he@@ re@@ vocab'.split(' '  )
          _UpperCamelCase     :       Any  						=  ['he re</w> 123', 'here a 1456']
          _UpperCamelCase     :       Tuple  						=  dict(zip(_A       ,			range(len(_A  )  )  )  )
  
          _UpperCamelCase     :       str  						=  {'pad_token': '<pad>', 'unk_token': '<unk>', 'bos_token': '<s>', 'eos_token': '</s>'}
  
          _UpperCamelCase     :       Optional[Any]  						=  tempfile.mkdtemp()
          _UpperCamelCase     :       Optional[int]  						=  os.path.join(self.tmpdirname       ,			VOCAB_FILES_NAMES['vocab_file']  )
          _UpperCamelCase     :       List[str]  						=  os.path.join(self.tmpdirname       ,			VOCAB_FILES_NAMES['merges_file']  )
  
          with open(self.vocab_file       ,			'w'       ,			encoding='utf-8'  ) as fp:
                 fp.write(json.dumps(_A  ) + '\n'  )
  
          with open(self.merges_file       ,			'w'  ) as fp:
                 fp.write('\n'.join(_A  )  )
  
   def 					__snake_case					(			self       :		Any  ) ->							Optional[int]:
          _UpperCamelCase     :       Union[str, Any]  						=  list(self.get_tokenizer().get_vocab().keys()  )
  
          self.assertEqual(vocab_keys[0]       ,			'<s>'  )
          self.assertEqual(vocab_keys[1]       ,			'<pad>'  )
          self.assertEqual(vocab_keys[-1]       ,			'vocab'  )
          self.assertEqual(len(_A  )       ,			1_4  )
  
   def 					__snake_case					(			self       :		List[Any]  ) ->							List[str]:
          self.assertEqual(self.get_tokenizer().vocab_size       ,			1_4  )
  
   def 					__snake_case					(			self       :		Optional[int]  ) ->							Tuple:
          _UpperCamelCase     :       Any  						=  SpeechaTextaTokenizer.from_pretrained(self.tmpdirname  )
  
          # make sure @@ is correctly concatenated
          _UpperCamelCase     :       List[Any]  						=  [4, 6, 8, 7, 1_0]  # ["here@@", "couple", "words", "of@@", "the"]
          _UpperCamelCase     :       Any  						=  tokenizer.decode(_A  )
  
          self.assertTrue(output_string == 'herecouple words ofthe'  )
  
   def 					__snake_case					(			self       :		List[str]  ) ->							str:
          _UpperCamelCase     :       int  						=  SpeechaTextaTokenizer.from_pretrained(self.tmpdirname  )
  
          with tempfile.TemporaryDirectory() as tmp_dirname:
                 tokenizer.save_pretrained(_A  )
                 os.remove(os.path.join(_A       ,			'merges.txt'  )  )
  
                 # load tokenizer without merges file should not throw an error
                 _UpperCamelCase     :       str  						=  SpeechaTextaTokenizer.from_pretrained(_A  )
  
          with tempfile.TemporaryDirectory() as tmp_dirname:
                 # save tokenizer and load again
                 tokenizer.save_pretrained(_A  )
                 _UpperCamelCase     :       Optional[int]  						=  SpeechaTextaTokenizer.from_pretrained(_A  )
  
          self.assertIsNotNone(_A  )
  
   def 					__snake_case					(			self       :		Dict  ) ->							Union[str, Any]:
          if not self.test_slow_tokenizer:
                 return
  
          _UpperCamelCase     :       Optional[Any]  						=  inspect.signature(self.tokenizer_class.__init__  )
          _UpperCamelCase     :       Optional[Any]  						=  self.get_tokenizer()
  
          for parameter_name, parameter in signature.parameters.items():
                 if parameter.default != inspect.Parameter.empty and parameter_name != "merges_file":
                        self.assertIn(_A       ,			tokenizer.init_kwargs  )
  
  
  
  
style_context: from ..utils import requires_backends
  
  
  UpperCAmelCase					=				None
  
  
  
  
  class    __lowerCAmelCase  :
  
  
  
   '''simple docstring'''
  
   def __init__(			self       :		Optional[int]       ,			*lowerCamelCase       :		Dict       ,			**lowerCamelCase       :		int  ) ->							Tuple:
          requires_backends(self       ,			['detectron2']  )
  
   @classmethod
   def 					__snake_case					(			cls       :		Optional[Any]       ,			*lowerCamelCase       :		Optional[int]       ,			**lowerCamelCase       :		Tuple  ) ->							List[str]:
          requires_backends(cls       ,			['detectron2']  )
  
  
  
  