




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


_lowerCamelCase	:		List[str]							       =   get_tests_dir("""fixtures/test_sentencepiece_bpe.model""")


class 				UpperCamelCase_    ( UpperCAmelCase__		,					unittest.TestCase     ):

    '''simple docstring'''






    UpperCAmelCase__							  =      BartphoTokenizer
    UpperCAmelCase__							  =      False
    UpperCAmelCase__							  =      True


    def        SCREAMING_SNAKE_CASE							(			self      :	Optional[Any])						->Union[str, Any]:





           '''simple docstring'''

           super().setUp()

           A__       =    ['''▁This''', '''▁is''', '''▁a''', '''▁t''', '''est''']
           A__       =    dict(zip(UpperCAmelCase__					, range(len(UpperCAmelCase__))))
           A__       =    {'''unk_token''': '''<unk>'''}

           A__       =    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""")

           A__       =    BartphoTokenizer(UpperCAmelCase__					, self.monolingual_vocab_file					, **self.special_tokens_map)
           tokenizer.save_pretrained(self.tmpdirname)


    def        SCREAMING_SNAKE_CASE							(			self      :	Optional[int]					, **UpperCAmelCase__      :	Dict)						->Any:





           '''simple docstring'''

           kwargs.update(self.special_tokens_map)
           return BartphoTokenizer.from_pretrained(self.tmpdirname					, **UpperCAmelCase__)


    def        SCREAMING_SNAKE_CASE							(			self      :	Union[str, Any]					, UpperCAmelCase__      :	Optional[Any])						->Union[str, Any]:





           '''simple docstring'''

           A__       =    '''This is a là test'''
           A__       =    '''This is a<unk><unk> test'''
           return input_text, output_text





    def        SCREAMING_SNAKE_CASE							(			self      :	Tuple)						->int:





           '''simple docstring'''

           A__       =    BartphoTokenizer(UpperCAmelCase__					, self.monolingual_vocab_file					, **self.special_tokens_map)
           A__       =    '''This is a là test'''
           A__       =    '''▁This ▁is ▁a ▁l à ▁t est'''.split()
           A__       =    tokenizer.tokenize(UpperCAmelCase__)
           self.assertListEqual(UpperCAmelCase__					, UpperCAmelCase__)

           A__       =    tokens + [tokenizer.unk_token]
           A__       =    [4, 5, 6, 3, 3, 7, 8, 3]
           self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCAmelCase__)					, UpperCAmelCase__)








def SCREAMING_SNAKE_CASE				(       lowercase_ ,				lowercase_						)   ->       int:



       """simple docstring"""

       return int(input_a == input_a == 0						)







def SCREAMING_SNAKE_CASE				(       )   ->       None:



       """simple docstring"""

       print('''Truth Table of NOR Gate:'''						)
       print('''|   Input 1   |  Input 2  | Output |'''						)
       print(f"""|      0      |    0      |  {nor_gate(0 ,				0						)}     |"""						)
       print(f"""|      0      |    1      |  {nor_gate(0 ,				1						)}     |"""						)
       print(f"""|      1      |    0      |  {nor_gate(1 ,				0						)}     |"""						)
       print(f"""|      1      |    1      |  {nor_gate(1 ,				1						)}     |"""						)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  main()


