


'''simple docstring'''





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 				UpperCAmelCase			(			_snake_case						, unittest.TestCase						):
 UpperCAmelCase				=					DebertaTokenizer
 UpperCAmelCase				=					True
 UpperCAmelCase				=					DebertaTokenizerFast


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

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

    UpperCAmelCase__	:str      =      os.path.join(self.tmpdirname			,       VOCAB_FILES_NAMES['''vocab_file'''] )
    UpperCAmelCase__	:Optional[Any]      =      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							:	Any			,       **__lowerCamelCase							:	List[Any] ):
    kwargs.update(self.special_tokens_map )
    return self.tokenizer_class.from_pretrained(self.tmpdirname			,       **__lowerCamelCase )


 def        __SCREAMING_SNAKE_CASE					(      self							:	List[str]			,       __lowerCamelCase							:	Tuple ):
    UpperCAmelCase__	:List[str]      =      '''lower newer'''
    UpperCAmelCase__	:str      =      '''lower newer'''
    return input_text, output_text


 def        __SCREAMING_SNAKE_CASE					(      self							:	List[str] ):
    UpperCAmelCase__	:Optional[Any]      =      self.get_tokenizer()
    UpperCAmelCase__	:List[str]      =      '''lower newer'''
    UpperCAmelCase__	:str      =      ['''l''', '''o''', '''w''', '''er''', '''\u0120''', '''n''', '''e''', '''w''', '''er''']
    UpperCAmelCase__	:int      =      tokenizer.tokenize(__lowerCamelCase )
    self.assertListEqual(__lowerCamelCase			,       __lowerCamelCase )

    UpperCAmelCase__	:List[Any]      =      tokens + [tokenizer.unk_token]
    UpperCAmelCase__	:Optional[int]      =      [0, 1, 2, 1_5, 1_0, 9, 3, 2, 1_5, 1_9]
    self.assertListEqual(tokenizer.convert_tokens_to_ids(__lowerCamelCase )			,       __lowerCamelCase )


 def        __SCREAMING_SNAKE_CASE					(      self							:	Optional[int] ):
    UpperCAmelCase__	:Tuple      =      self.get_tokenizer()
    UpperCAmelCase__	:Dict      =      tokenizer('''Hello'''			,       '''World''' )
    UpperCAmelCase__	:Any      =      [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							:	Union[str, Any] ):
    UpperCAmelCase__	:Any      =      self.tokenizer_class.from_pretrained('''microsoft/deberta-base''' )

    UpperCAmelCase__	:Any      =      tokenizer.encode('''sequence builders'''			,       add_special_tokens=__lowerCamelCase )
    UpperCAmelCase__	:Union[str, Any]      =      tokenizer.encode('''multi-sequence build'''			,       add_special_tokens=__lowerCamelCase )

    UpperCAmelCase__	:Optional[Any]      =      tokenizer.encode(
        '''sequence builders'''			,       add_special_tokens=__lowerCamelCase			,       add_prefix_space=__lowerCamelCase )
    UpperCAmelCase__	:Optional[int]      =      tokenizer.encode(
        '''sequence builders'''			,       '''multi-sequence build'''			,       add_special_tokens=__lowerCamelCase			,       add_prefix_space=__lowerCamelCase )

    UpperCAmelCase__	:Optional[int]      =      tokenizer.build_inputs_with_special_tokens(__lowerCamelCase )
    UpperCAmelCase__	:Optional[int]      =      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							:	str ):
    UpperCAmelCase__	:str      =      [self.tokenizer_class]
    if self.test_rust_tokenizer:
       tokenizer_classes.append(self.rust_tokenizer_class )

    for tokenizer_class in tokenizer_classes:
       UpperCAmelCase__	:List[Any]      =      tokenizer_class.from_pretrained('''microsoft/deberta-base''' )

       UpperCAmelCase__	:Tuple      =      [
           '''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.''',
       ]

       UpperCAmelCase__	:Optional[int]      =      tokenizer(__lowerCamelCase			,       padding=__lowerCamelCase )
       UpperCAmelCase__	:List[str]      =      [tokenizer.decode(__lowerCamelCase			,       skip_special_tokens=__lowerCamelCase ) for seq in encoding['''input_ids''']]

       # fmt: off
       UpperCAmelCase__	:List[str]      =      {
           '''input_ids''': [
               [1, 2_1_1_8, 1_1_1_2_6, 5_6_5, 3_5, 8_3, 2_5_1_9_1, 1_6_3, 1_8_8_5_4, 1_3, 1_2_1_5_6, 1_2, 1_6_1_0_1, 2_5_3_7_6, 1_3_8_0_7, 9, 2_2_2_0_5, 2_7_8_9_3, 1_6_3_5, 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, 2_1_1_8, 1_1_1_2_6, 5_6_5, 2_4_5_3_6, 8_0, 4_3_7_9_7, 4_8_7_8, 7_3_7_3, 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_3_3, 7_8, 6_5, 1_6, 1_0, 3_7_2_4, 1_5_3_8, 3_3_1_8_3, 1_1_3_0_3, 4_3_7_9_7, 1_9_3_8, 4, 8_7_0, 2_4_1_6_5, 2_9_1_0_5, 5, 7_3_9, 3_2_6_4_4, 3_3_1_8_3, 1_1_3_0_3, 3_6_1_7_3, 8_8, 8_0, 6_5_0, 7_8_2_1, 4_5_9_4_0, 6, 5_2, 2_5_5_9, 5, 1_8_3_6, 9, 5, 7_3_9_7, 1_3_1_7_1, 3_1, 5, 1_8_3_6, 9, 3_2_6_4_4, 3_3_1_8_3, 1_1_3_0_3, 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

       UpperCAmelCase__	: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.''',
       ]

       self.assertDictEqual(encoding.data			,       __lowerCamelCase )

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







'''simple docstring'''





from functools import reduce

__lowerCamelCase												=						(
    '''73167176531330624919225119674426574742355349194934'''
    '''96983520312774506326239578318016984801869478851843'''
    '''85861560789112949495459501737958331952853208805511'''
    '''12540698747158523863050715693290963295227443043557'''
    '''66896648950445244523161731856403098711121722383113'''
    '''62229893423380308135336276614282806444486645238749'''
    '''30358907296290491560440772390713810515859307960866'''
    '''70172427121883998797908792274921901699720888093776'''
    '''65727333001053367881220235421809751254540594752243'''
    '''52584907711670556013604839586446706324415722155397'''
    '''53697817977846174064955149290862569321978468622482'''
    '''83972241375657056057490261407972968652414535100474'''
    '''82166370484403199890008895243450658541227588666881'''
    '''16427171479924442928230863465674813919123162824586'''
    '''17866458359124566529476545682848912883142607690042'''
    '''24219022671055626321111109370544217506941658960408'''
    '''07198403850962455444362981230987879927244284909188'''
    '''84580156166097919133875499200524063689912560717606'''
    '''05886116467109405077541002256983155200055935729725'''
    '''71636269561882670428252483600823257530420752963450'''
)


def        a__     (					UpperCamelCase_						:      str = N						):
   return max(
       # mypy cannot properly interpret reduce
       int(reduce(lambda UpperCamelCase_,   UpperCamelCase_						: str(int(UpperCamelCase_						) * int(UpperCamelCase_						)						),   n[i : i + 13]						)						)
       for i in range(len(UpperCamelCase_						) - 12						)						)


if __name__ == "__main__":
    print(F'''{solution() = }''')



