






import json
import os
import unittest

from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import (
    VOCAB_FILES_NAMES,
    GPTSanJapaneseTokenizer,
)
from transformers.testing_utils import require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin
@require_tokenizers
class        a       (					lowercase__				,			unittest.TestCase  ):



      """simple docstring"""


      a    :					Optional[int]							=      GPTSanJapaneseTokenizer
      a    :					Optional[Any]							=      False
      a    :					List[str]							=      {'do_clean_text': False, 'add_prefix_space': False}
      def       UpperCAmelCase ( self   :     Tuple   )				-> Any:
        super().setUp()

        # fmt: off
        __UpperCAmelCase				:      Tuple	 =    ["""こん""", """こんに""", """にちは""", """ばんは""", """世界,㔺界""", """、""", """。""", """<BR>""", """<SP>""", """<TAB>""", """<URL>""", """<EMAIL>""", """<TEL>""", """<DATE>""", """<PRICE>""", """<BLOCK>""", """<KIGOU>""", """<U2000U2BFF>""", """<|emoji1|>""", """<unk>""", """<|bagoftoken|>""", """<|endoftext|>"""]
        # fmt: on
        __UpperCAmelCase				:      Dict	 =    {"""emoji""": {"""\ud83d\ude00""": """<|emoji1|>"""}, """emoji_inv""": {"""<|emoji1|>""": """\ud83d\ude00"""}}  # 😀
        __UpperCAmelCase				:      Dict	 =    {"""unk_token""": """<unk>"""}

        __UpperCAmelCase				:      str	 =    os.path.join(self.tmpdirname						, VOCAB_FILES_NAMES["""vocab_file"""]   )
        __UpperCAmelCase				:      str	 =    os.path.join(self.tmpdirname						, VOCAB_FILES_NAMES["""emoji_file"""]   )
        with open(self.vocab_file						, """w"""						, encoding="""utf-8"""   ) as vocab_writer:
          vocab_writer.write("""""".join([x + """\n""" for x in vocab_tokens]   )   )
        with open(self.emoji_file						, """w"""   ) as emoji_writer:
          emoji_writer.write(json.dumps(__lowercase   )   )
      def       UpperCAmelCase ( self   :     Tuple						, **__lowercase   :     int   )				-> Any:
        kwargs.update(self.special_tokens_map   )
        return GPTSanJapaneseTokenizer.from_pretrained(self.tmpdirname						, **__lowercase   )
      def       UpperCAmelCase ( self   :     str						, __lowercase   :     Union[str, Any]   )				-> Any:
        __UpperCAmelCase				:      Any	 =    """こんにちは、世界。 \nこんばんは、㔺界。😀"""
        __UpperCAmelCase				:      int	 =    """こんにちは、世界。 \nこんばんは、世界。😀"""
        return input_text, output_text
      def       UpperCAmelCase ( self   :     List[Any]						, __lowercase   :     Optional[int]   )				-> List[Any]:
        __UpperCAmelCase ,					__UpperCAmelCase				:      int	 =    self.get_input_output_texts(__lowercase   )
        __UpperCAmelCase				:      Tuple	 =    tokenizer.encode(__lowercase						, add_special_tokens=__lowercase   )
        __UpperCAmelCase				:      Dict	 =    tokenizer.decode(__lowercase						, clean_up_tokenization_spaces=__lowercase   )
        return text, ids
      def       UpperCAmelCase ( self   :     int   )				-> Optional[Any]:
        pass  # TODO add if relevant
      def       UpperCAmelCase ( self   :     Union[str, Any]   )				-> Union[str, Any]:
        pass  # TODO add if relevant
      def       UpperCAmelCase ( self   :     Dict   )				-> Tuple:
        pass  # TODO add if relevant
      def       UpperCAmelCase ( self   :     str   )				-> Tuple:
        __UpperCAmelCase				:      List[str]	 =    self.get_tokenizer()

        # Testing tokenization
        __UpperCAmelCase				:      int	 =    """こんにちは、世界。　こんばんは、㔺界。"""
        __UpperCAmelCase				:      Dict	 =    ["""こん""", """にちは""", """、""", """世界""", """。""", """<SP>""", """こん""", """ばんは""", """、""", """㔺界""", """。"""]
        __UpperCAmelCase				:      Optional[Any]	 =    tokenizer.tokenize(__lowercase   )
        self.assertListEqual(__lowercase						, __lowercase   )

        # Testing conversion to ids without special tokens
        __UpperCAmelCase				:      List[str]	 =    [0, 2, 5, 4, 6, 8, 0, 3, 5, 4, 6]
        __UpperCAmelCase				:      Optional[Any]	 =    tokenizer.convert_tokens_to_ids(__lowercase   )
        self.assertListEqual(__lowercase						, __lowercase   )

        # Testing conversion to ids with special tokens
        __UpperCAmelCase				:      List[Any]	 =    tokens + [tokenizer.unk_token]
        __UpperCAmelCase				:      str	 =    [0, 2, 5, 4, 6, 8, 0, 3, 5, 4, 6, 19]
        __UpperCAmelCase				:      Any	 =    tokenizer.convert_tokens_to_ids(__lowercase   )
        self.assertListEqual(__lowercase						, __lowercase   )
      def       UpperCAmelCase ( self   :     Tuple   )				-> Dict:
        __UpperCAmelCase				:      int	 =    self.get_tokenizer()

        # Testing tokenization
        __UpperCAmelCase				:      Tuple	 =    """こんにちは、<|bagoftoken|>世界。こんばんは、<|bagoftoken|>㔺界。"""
        __UpperCAmelCase				:      int	 =    """こんにちは、、、、世界。こんばんは、、、、世界。"""
        __UpperCAmelCase				:      Tuple	 =    tokenizer.encode(__lowercase   )
        __UpperCAmelCase				:      int	 =    tokenizer.decode(__lowercase   )
        self.assertEqual(__lowercase						, __lowercase   )
      @slow
      def       UpperCAmelCase ( self   :     int   )				-> Optional[int]:
        __UpperCAmelCase				:      Tuple	 =    self.tokenizer_class.from_pretrained("""Tanrei/GPTSAN-japanese"""   )

        # Testing tokenization
        __UpperCAmelCase				:      List[Any]	 =    """こんにちは、世界。"""
        __UpperCAmelCase				:      Optional[int]	 =    """こんばんは、㔺界。😀"""
        __UpperCAmelCase				:      List[Any]	 =    """こんにちは、世界。こんばんは、世界。😀"""
        __UpperCAmelCase				:      List[str]	 =    tokenizer.encode(prefix_text + input_text   )
        __UpperCAmelCase				:      List[Any]	 =    tokenizer.encode(""""""						, prefix_text=prefix_text + input_text   )
        __UpperCAmelCase				:      Any	 =    tokenizer.encode(__lowercase						, prefix_text=__lowercase   )
        __UpperCAmelCase				:      Optional[int]	 =    tokenizer.decode(__lowercase   )
        __UpperCAmelCase				:      Any	 =    tokenizer.decode(__lowercase   )
        __UpperCAmelCase				:      Optional[Any]	 =    tokenizer.decode(__lowercase   )
        self.assertEqual(__lowercase						, __lowercase   )
        self.assertEqual(__lowercase						, __lowercase   )
        self.assertEqual(__lowercase						, __lowercase   )
      @slow
      def       UpperCAmelCase ( self   :     Any   )				-> str:
        __UpperCAmelCase				:      int	 =    self.tokenizer_class.from_pretrained("""Tanrei/GPTSAN-japanese"""   )

        # Testing tokenization
        __UpperCAmelCase				:      int	 =    """こんにちは、世界。"""
        __UpperCAmelCase				:      List[Any]	 =    """こんばんは、㔺界。😀"""

        __UpperCAmelCase				:      Union[str, Any]	 =    len(tokenizer.encode(__lowercase   )   ) - 2
        __UpperCAmelCase				:      int	 =    len(tokenizer.encode(__lowercase   )   ) - 2

        __UpperCAmelCase				:      List[Any]	 =    [1] + [0] * (len_prefix + len_text + 1)
        __UpperCAmelCase				:      Union[str, Any]	 =    [1] * (len_prefix + len_text + 1) + [0]
        __UpperCAmelCase				:      List[Any]	 =    [1] + [1] * (len_prefix) + [0] * (len_text + 1)

        __UpperCAmelCase				:      Union[str, Any]	 =    tokenizer(prefix_text + input_text   ).token_type_ids
        __UpperCAmelCase				:      Optional[Any]	 =    tokenizer(""""""						, prefix_text=prefix_text + input_text   ).token_type_ids
        __UpperCAmelCase				:      Tuple	 =    tokenizer(__lowercase						, prefix_text=__lowercase   ).token_type_ids
        self.assertListEqual(__lowercase						, __lowercase   )
        self.assertListEqual(__lowercase						, __lowercase   )
        self.assertListEqual(__lowercase						, __lowercase   )
      @slow
      def       UpperCAmelCase ( self   :     List[str]   )				-> int:
        __UpperCAmelCase				:      Tuple	 =    self.tokenizer_class.from_pretrained("""Tanrei/GPTSAN-japanese"""   )

        __UpperCAmelCase				:      Optional[int]	 =    tokenizer.encode("""あンいワ"""   )
        __UpperCAmelCase				:      Tuple	 =    tokenizer.encode(""""""						, prefix_text="""あンいワ"""   )
        __UpperCAmelCase				:      Optional[int]	 =    tokenizer.encode("""いワ"""						, prefix_text="""あン"""   )

        self.assertEqual(tokenizer.decode(__lowercase   )						, tokenizer.decode(__lowercase   )   )
        self.assertEqual(tokenizer.decode(__lowercase   )						, tokenizer.decode(__lowercase   )   )
        self.assertNotEqual(__lowercase						, __lowercase   )
        self.assertNotEqual(__lowercase						, __lowercase   )
        self.assertEqual(x_token_a[1]						, x_token_a[-1]   )  # SEG token
        self.assertEqual(x_token_a[1]						, x_token_a[3]   )  # SEG token
      @slow
      def       UpperCAmelCase ( self   :     List[Any]   )				-> List[str]:
        __UpperCAmelCase				:      Any	 =    self.tokenizer_class.from_pretrained("""Tanrei/GPTSAN-japanese"""   )

        __UpperCAmelCase				:      List[Any]	 =    [["""武田信玄""", """は、"""], ["""織田信長""", """の配下の、"""]]
        __UpperCAmelCase				:      int	 =    tokenizer(__lowercase						, padding=__lowercase   )
        __UpperCAmelCase				:      Optional[Any]	 =    tokenizer.batch_encode_plus(__lowercase						, padding=__lowercase   )

        # fmt: off
        __UpperCAmelCase				:      Optional[int]	 =    [[35993, 8640, 25948, 35998, 30647, 35675, 35999, 35999], [35993, 10382, 9868, 35998, 30646, 9459, 30646, 35675]]
        __UpperCAmelCase				:      Tuple	 =    [[1, 1, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0]]
        __UpperCAmelCase				:      Union[str, Any]	 =    [[1, 1, 1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1]]
        # fmt: on
        self.assertListEqual(x_token.input_ids						, __lowercase   )
        self.assertListEqual(x_token.token_type_ids						, __lowercase   )
        self.assertListEqual(x_token.attention_mask						, __lowercase   )
        self.assertListEqual(x_token_a.input_ids						, __lowercase   )
        self.assertListEqual(x_token_a.token_type_ids						, __lowercase   )
        self.assertListEqual(x_token_a.attention_mask						, __lowercase   )
      def       UpperCAmelCase ( self   :     List[str]   )				-> Union[str, Any]:
        # Intentionally convert some words to accommodate character fluctuations unique to Japanese
        pass




      def       UpperCAmelCase ( self   :     Any   )				-> int:
        # tokenizer has no padding token
        pass




"""simple docstring"""

import math




def      lowercase__    (       lowerCAmelCase					:       str			,					lowerCAmelCase					:       Optional[Any]			)			->   List[Any]:






    """simple docstring"""




    if 0 not in (x, y):
        # We use the relation x^y = y*log10(x), where 10 is the base.
        return y * math.logaa(lowerCAmelCase			)
    else:
        if x == 0:  # 0 raised to any number is 0
            return 0
        elif y == 0:
            return 1  # any number raised to 0 is 1
    raise AssertionError('This should never happen'			)


if __name__ == "__main__":  # Main function
   # Read two numbers from input and typecast them to int using map function.
   # Here x is the base and y is the power.
   SCREAMING_SNAKE_CASE_            =    '''Enter the base and the power separated by a comma: '''
   SCREAMING_SNAKE_CASE_       ,    SCREAMING_SNAKE_CASE_            =    map(int, input(prompt).split(''','''))
   SCREAMING_SNAKE_CASE_       ,    SCREAMING_SNAKE_CASE_            =    map(int, input(prompt).split(''','''))

   # We find the log of each number, using the function res(), which takes two
   # arguments.
   SCREAMING_SNAKE_CASE_            =    res(xa, ya)
   SCREAMING_SNAKE_CASE_            =    res(xa, ya)

   # We check for the largest number
   if resa > resa:
      print('''Largest number is''', xa, '''^''', ya)
   elif resa > resa:
      print('''Largest number is''', xa, '''^''', ya)
   else:
      print('''Both are equal''')



