

__UpperCAmelCase								=			[
    999,
    800,
    799,
    600,
    599,
    500,
    400,
    399,
    377,
    355,
    333,
    311,
    288,
    266,
    244,
    222,
    200,
    199,
    177,
    155,
    133,
    111,
    88,
    66,
    44,
    22,
    0,
]

__UpperCAmelCase								=			[
    999,
    976,
    952,
    928,
    905,
    882,
    858,
    857,
    810,
    762,
    715,
    714,
    572,
    429,
    428,
    286,
    285,
    238,
    190,
    143,
    142,
    118,
    95,
    71,
    47,
    24,
    0,
]

__UpperCAmelCase								=			[
    999,
    988,
    977,
    966,
    955,
    944,
    933,
    922,
    911,
    900,
    899,
    879,
    859,
    840,
    820,
    800,
    799,
    766,
    733,
    700,
    699,
    650,
    600,
    599,
    500,
    499,
    400,
    399,
    350,
    300,
    299,
    266,
    233,
    200,
    199,
    179,
    159,
    140,
    120,
    100,
    99,
    88,
    77,
    66,
    55,
    44,
    33,
    22,
    11,
    0,
]

__UpperCAmelCase								=			[
    999,
    995,
    992,
    989,
    985,
    981,
    978,
    975,
    971,
    967,
    964,
    961,
    957,
    956,
    951,
    947,
    942,
    937,
    933,
    928,
    923,
    919,
    914,
    913,
    908,
    903,
    897,
    892,
    887,
    881,
    876,
    871,
    870,
    864,
    858,
    852,
    846,
    840,
    834,
    828,
    827,
    820,
    813,
    806,
    799,
    792,
    785,
    784,
    777,
    770,
    763,
    756,
    749,
    742,
    741,
    733,
    724,
    716,
    707,
    699,
    698,
    688,
    677,
    666,
    656,
    655,
    645,
    634,
    623,
    613,
    612,
    598,
    584,
    570,
    569,
    555,
    541,
    527,
    526,
    505,
    484,
    483,
    462,
    440,
    439,
    396,
    395,
    352,
    351,
    308,
    307,
    264,
    263,
    220,
    219,
    176,
    132,
    88,
    44,
    0,
]

__UpperCAmelCase								=			[
    999,
    997,
    995,
    992,
    990,
    988,
    986,
    984,
    981,
    979,
    977,
    975,
    972,
    970,
    968,
    966,
    964,
    961,
    959,
    957,
    956,
    954,
    951,
    949,
    946,
    944,
    941,
    939,
    936,
    934,
    931,
    929,
    926,
    924,
    921,
    919,
    916,
    914,
    913,
    910,
    907,
    905,
    902,
    899,
    896,
    893,
    891,
    888,
    885,
    882,
    879,
    877,
    874,
    871,
    870,
    867,
    864,
    861,
    858,
    855,
    852,
    849,
    846,
    843,
    840,
    837,
    834,
    831,
    828,
    827,
    824,
    821,
    817,
    814,
    811,
    808,
    804,
    801,
    798,
    795,
    791,
    788,
    785,
    784,
    780,
    777,
    774,
    770,
    766,
    763,
    760,
    756,
    752,
    749,
    746,
    742,
    741,
    737,
    733,
    730,
    726,
    722,
    718,
    714,
    710,
    707,
    703,
    699,
    698,
    694,
    690,
    685,
    681,
    677,
    673,
    669,
    664,
    660,
    656,
    655,
    650,
    646,
    641,
    636,
    632,
    627,
    622,
    618,
    613,
    612,
    607,
    602,
    596,
    591,
    586,
    580,
    575,
    570,
    569,
    563,
    557,
    551,
    545,
    539,
    533,
    527,
    526,
    519,
    512,
    505,
    498,
    491,
    484,
    483,
    474,
    466,
    457,
    449,
    440,
    439,
    428,
    418,
    407,
    396,
    395,
    381,
    366,
    352,
    351,
    330,
    308,
    307,
    286,
    264,
    263,
    242,
    220,
    219,
    176,
    175,
    132,
    131,
    88,
    44,
    0,
]

__UpperCAmelCase								=			[
    999,
    991,
    982,
    974,
    966,
    958,
    950,
    941,
    933,
    925,
    916,
    908,
    900,
    899,
    874,
    850,
    825,
    800,
    799,
    700,
    600,
    500,
    400,
    300,
    200,
    100,
    0,
]

__UpperCAmelCase								=			[
    999,
    992,
    985,
    978,
    971,
    964,
    957,
    949,
    942,
    935,
    928,
    921,
    914,
    907,
    900,
    899,
    879,
    859,
    840,
    820,
    800,
    799,
    766,
    733,
    700,
    699,
    650,
    600,
    599,
    500,
    499,
    400,
    399,
    300,
    299,
    200,
    199,
    100,
    99,
    0,
]

__UpperCAmelCase								=			[
    999,
    996,
    992,
    989,
    985,
    982,
    979,
    975,
    972,
    968,
    965,
    961,
    958,
    955,
    951,
    948,
    944,
    941,
    938,
    934,
    931,
    927,
    924,
    920,
    917,
    914,
    910,
    907,
    903,
    900,
    899,
    891,
    884,
    876,
    869,
    861,
    853,
    846,
    838,
    830,
    823,
    815,
    808,
    800,
    799,
    788,
    777,
    766,
    755,
    744,
    733,
    722,
    711,
    700,
    699,
    688,
    677,
    666,
    655,
    644,
    633,
    622,
    611,
    600,
    599,
    585,
    571,
    557,
    542,
    528,
    514,
    500,
    499,
    485,
    471,
    457,
    442,
    428,
    414,
    400,
    399,
    379,
    359,
    340,
    320,
    300,
    299,
    279,
    259,
    240,
    220,
    200,
    199,
    166,
    133,
    100,
    99,
    66,
    33,
    0,
]





import json
import os
import unittest

from transformers import DebertaTokenizer, DebertaTokenizerFast
from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES
from transformers.testing_utils import slow

from ...test_tokenization_common import TokenizerTesterMixin



class SCREAMING_SNAKE_CASE     (  a_       ,							unittest.TestCase			):
  """simple docstring"""






  lowerCamelCase   :      str										=DebertaTokenizer
  lowerCamelCase   :      Dict										=True
  lowerCamelCase   :      List[str]										=DebertaTokenizerFast







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






     """simple docstring"""







     super().setUp()

     # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
     __lowerCAmelCase  :      Optional[int]    =						[
         """l""",
         """o""",
         """w""",
         """e""",
         """r""",
         """s""",
         """t""",
         """i""",
         """d""",
         """n""",
         """\u0120""",
         """\u0120l""",
         """\u0120n""",
         """\u0120lo""",
         """\u0120low""",
         """er""",
         """\u0120lowest""",
         """\u0120newer""",
         """\u0120wider""",
         """[UNK]""",
     ]
     __lowerCAmelCase  :      Optional[int]    =						dict(zip(lowerCAmelCase	,							range(len(lowerCAmelCase   )   )   )   )
     __lowerCAmelCase  :      List[str]    =						["""#version: 0.2""", """\u0120 l""", """\u0120l o""", """\u0120lo w""", """e r""", """"""]
     __lowerCAmelCase  :      Any    =						{"""unk_token""": """[UNK]"""}

     __lowerCAmelCase  :      Tuple    =						os.path.join(self.tmpdirname	,							VOCAB_FILES_NAMES["""vocab_file"""]   )
     __lowerCAmelCase  :      Optional[int]    =						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(lowerCAmelCase   ) + """\n"""   )
     with open(self.merges_file	,							"""w"""	,							encoding="""utf-8"""   ) as fp:
        fp.write("""\n""".join(lowerCAmelCase   )   )







  def 	SCREAMING_SNAKE_CASE   (      self			:   Optional[int]	,							**lowerCAmelCase			:   Tuple   )							->     Dict:






     """simple docstring"""







     kwargs.update(self.special_tokens_map   )
     return self.tokenizer_class.from_pretrained(self.tmpdirname	,							**lowerCAmelCase   )







  def 	SCREAMING_SNAKE_CASE   (      self			:   List[str]	,							lowerCAmelCase			:   int   )							->     Optional[Any]:






     """simple docstring"""







     __lowerCAmelCase  :      Dict    =						"""lower newer"""
     __lowerCAmelCase  :      Union[str, Any]    =						"""lower newer"""
     return input_text, output_text







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






     """simple docstring"""







     __lowerCAmelCase  :      List[Any]    =						self.get_tokenizer()
     __lowerCAmelCase  :      int    =						"""lower newer"""
     __lowerCAmelCase  :      Any    =						["""l""", """o""", """w""", """er""", """\u0120""", """n""", """e""", """w""", """er"""]
     __lowerCAmelCase  :      Union[str, Any]    =						tokenizer.tokenize(lowerCAmelCase   )
     self.assertListEqual(lowerCAmelCase	,							lowerCAmelCase   )

     __lowerCAmelCase  :      List[Any]    =						tokens + [tokenizer.unk_token]
     __lowerCAmelCase  :      Union[str, Any]    =						[0, 1, 2, 15, 10, 9, 3, 2, 15, 19]
     self.assertListEqual(tokenizer.convert_tokens_to_ids(lowerCAmelCase   )	,							lowerCAmelCase   )







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






     """simple docstring"""







     __lowerCAmelCase  :      int    =						self.get_tokenizer()
     __lowerCAmelCase  :      Any    =						tokenizer("""Hello"""	,							"""World"""   )
     __lowerCAmelCase  :      Tuple    =						[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
     self.assertListEqual(tokd["""token_type_ids"""]	,							lowerCAmelCase   )







  @slow
  def 	SCREAMING_SNAKE_CASE   (      self			:   Dict   )							->     str:






     """simple docstring"""







     __lowerCAmelCase  :      Optional[int]    =						self.tokenizer_class.from_pretrained("""microsoft/deberta-base"""   )

     __lowerCAmelCase  :      Optional[Any]    =						tokenizer.encode("""sequence builders"""	,							add_special_tokens=lowerCAmelCase   )
     __lowerCAmelCase  :      List[Any]    =						tokenizer.encode("""multi-sequence build"""	,							add_special_tokens=lowerCAmelCase   )

     __lowerCAmelCase  :      Dict    =						tokenizer.encode(
         """sequence builders"""	,							add_special_tokens=lowerCAmelCase	,							add_prefix_space=lowerCAmelCase   )
     __lowerCAmelCase  :      Dict    =						tokenizer.encode(
         """sequence builders"""	,							"""multi-sequence build"""	,							add_special_tokens=lowerCAmelCase	,							add_prefix_space=lowerCAmelCase   )

     __lowerCAmelCase  :      List[str]    =						tokenizer.build_inputs_with_special_tokens(lowerCAmelCase   )
     __lowerCAmelCase  :      Union[str, Any]    =						tokenizer.build_inputs_with_special_tokens(lowerCAmelCase	,							lowerCAmelCase   )

     assert encoded_sentence == encoded_text_from_decode
     assert encoded_pair == encoded_pair_from_decode







  @slow
  def 	SCREAMING_SNAKE_CASE   (      self			:   List[str]   )							->     Optional[Any]:






     """simple docstring"""







     __lowerCAmelCase  :      List[str]    =						[self.tokenizer_class]
     if self.test_rust_tokenizer:
        tokenizer_classes.append(self.rust_tokenizer_class   )

     for tokenizer_class in tokenizer_classes:
        __lowerCAmelCase  :      int    =						tokenizer_class.from_pretrained("""microsoft/deberta-base"""   )

        __lowerCAmelCase  :      Optional[Any]    =						[
            """ALBERT: A Lite BERT for Self-supervised Learning of Language Representations""",
            """ALBERT incorporates two parameter reduction techniques""",
            """The first one is a factorized embedding parameterization. By decomposing the large vocabulary"""
            """ embedding matrix into two small matrices, we separate the size of the hidden layers from the size of"""
            """ vocabulary embedding.""",
        ]

        __lowerCAmelCase  :      List[str]    =						tokenizer(lowerCAmelCase	,							padding=lowerCAmelCase   )
        __lowerCAmelCase  :      List[str]    =						[tokenizer.decode(lowerCAmelCase	,							skip_special_tokens=lowerCAmelCase   ) for seq in encoding["""input_ids"""]]

        # fmt: off
        __lowerCAmelCase  :      Any    =						{
            """input_ids""": [
                [1, 21_18, 1_11_26, 5_65, 35, 83, 2_51_91, 1_63, 1_88_54, 13, 1_21_56, 12, 1_61_01, 2_53_76, 1_38_07, 9, 2_22_05, 2_78_93, 16_35, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [1, 21_18, 1_11_26, 5_65, 2_45_36, 80, 4_37_97, 48_78, 73_73, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [1, 1_33, 78, 65, 16, 10, 37_24, 15_38, 3_31_83, 1_13_03, 4_37_97, 19_38, 4, 8_70, 2_41_65, 2_91_05, 5, 7_39, 3_26_44, 3_31_83, 1_13_03, 3_61_73, 88, 80, 6_50, 78_21, 4_59_40, 6, 52, 25_59, 5, 18_36, 9, 5, 73_97, 1_31_71, 31, 5, 18_36, 9, 3_26_44, 3_31_83, 1_13_03, 4, 2]
            ],
            """token_type_ids""": [
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            ],
            """attention_mask""": [
                [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
            ]
        }
        # fmt: on

        __lowerCAmelCase  :      int    =						[
            """ALBERT: A Lite BERT for Self-supervised Learning of Language Representations""",
            """ALBERT incorporates two parameter reduction techniques""",
            """The first one is a factorized embedding parameterization. By decomposing the large vocabulary"""
            """ embedding matrix into two small matrices, we separate the size of the hidden layers from the size of"""
            """ vocabulary embedding.""",
        ]

        self.assertDictEqual(encoding.data	,							lowerCAmelCase   )

        for expected, decoded in zip(lowerCAmelCase	,							lowerCAmelCase   ):
           self.assertEqual(lowerCAmelCase	,							lowerCAmelCase   )


