


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


snake_case__				:	List[Any]					       =					get_tests_dir('fixtures/test_sentencepiece_bpe.model')





class   SCREAMING_SNAKE_CASE_			(a__						,       unittest.TestCase						):




       '''simple docstring'''



       _a   							=							BartphoTokenizer
       _a   							=							False
       _a   							=							True



       def 				_lowerCAmelCase							(						self				:				str							)					->str:
          super().setUp()

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

          lowerCamelCase_						:   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'''							)

          lowerCamelCase_						:   Optional[Any]		= BartphoTokenizer(__a		,				self.monolingual_vocab_file		,				**self.special_tokens_map							)
          tokenizer.save_pretrained(self.tmpdirname							)



       def 				_lowerCAmelCase							(						self				:				Union[str, Any]		,				**__a				:				Union[str, Any]							)					->Any:
          kwargs.update(self.special_tokens_map							)
          return BartphoTokenizer.from_pretrained(self.tmpdirname		,				**__a							)



       def 				_lowerCAmelCase							(						self				:				Optional[Any]		,				__a				:				Optional[Any]							)					->List[Any]:
          lowerCamelCase_						:   int		= """This is a là test"""
          lowerCamelCase_						:   int		= """This is a<unk><unk> test"""
          return input_text, output_text




       def 				_lowerCAmelCase							(						self				:				List[str]							)					->List[Any]:
          lowerCamelCase_						:   List[str]		= BartphoTokenizer(__a		,				self.monolingual_vocab_file		,				**self.special_tokens_map							)
          lowerCamelCase_						:   Tuple		= """This is a là test"""
          lowerCamelCase_						:   int		= """▁This ▁is ▁a ▁l à ▁t est""".split()
          lowerCamelCase_						:   List[Any]		= tokenizer.tokenize(__a							)
          self.assertListEqual(__a		,				__a							)

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









def    __lowerCamelCase   (      A__						: int						,						A__						: int					)     ->    int:
   return int((input_a, input_a).count(0					) == 0					)


def    __lowerCamelCase   (      )     ->    None:
   assert and_gate(0						,						0					) == 0
   assert and_gate(0						,						1					) == 0
   assert and_gate(1						,						0					) == 0
   assert and_gate(1						,						1					) == 1


if __name__ == "__main__":
      test_and_gate()
      print(and_gate(1, 0))
      print(and_gate(0, 0))
      print(and_gate(0, 1))
      print(and_gate(1, 1))





