





import unittest

from cer import CER


lowercase     :			List[str]     						=	CER()

class 			__A(    unittest.TestCase			):

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''White House''']
            _UpperCamelCase														=    ['''white house''']
            # S = 2, D = 0, I = 0, N = 11, CER = 2 / 11
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.1_818_181_818   ) < 1E-6   )

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''were wolf''']
            _UpperCamelCase														=    ['''werewolf''']
            # S = 0, D = 0, I = 1, N = 9, CER = 1 / 9
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.1_111_111   ) < 1E-6   )

            _UpperCamelCase														=    ['''werewolf''']
            _UpperCamelCase														=    ['''weae     wolf''']
            # S = 1, D = 1, I = 0, N = 8, CER = 0.25
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.25   ) < 1E-6   )

            # consecutive whitespaces case 1
            _UpperCamelCase														=    ['''were wolf''']
            _UpperCamelCase														=    ['''were               wolf''']
            # S = 0, D = 0, I = 0, N = 9, CER = 0
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.0   ) < 1E-6   )

            # consecutive whitespaces case 2
            _UpperCamelCase														=    ['''were   wolf''']
            _UpperCamelCase														=    ['''were               wolf''']
            # S = 0, D = 0, I = 0, N = 9, CER = 0
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.0   ) < 1E-6   )

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''werewolf''']
            _UpperCamelCase														=    ['''weaewolf''']
            # S = 1, D = 0, I = 0, N = 8, CER = 0.125
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.125   ) < 1E-6   )

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''werewolf''']
            _UpperCamelCase														=    ['''wereawolf''']
            # S = 0, D = 1, I = 0, N = 8, CER = 0.125
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.125   ) < 1E-6   )

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''werewolf''']
            _UpperCamelCase														=    ['''wereolf''']
            # S = 0, D = 0, I = 1, N = 8, CER = 0.125
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.125   ) < 1E-6   )

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''werewolf''']
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertEqual(A,							0.0   )

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''werewolf''', '''I am your father''']
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertEqual(A,							0.0   )

            _UpperCamelCase														=    ['''werewolf''', '''I am your father''', '''doge''']
            _UpperCamelCase														=    ['''werxwolf''', '''I       am your father''', '''doge''']
            # S = 1, D = 0, I = 0, N = 28, CER = 1 / 28
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.03_571_428   ) < 1E-6   )

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''My hovercraft''', '''is full of eels''']
            _UpperCamelCase														=    ['''My hovercraft is full''', ''' of eels''']
            # S = 0, D = 0, I = 2, N = 28, CER = 2 / 28
            # whitespace at the front of " of eels" will be strip during preporcessing
            # so need to insert 2 whitespaces
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A,							concatenate_texts=A   )
            self.assertTrue(abs(char_error_rate - 0.071_428   ) < 1E-6   )

     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''我能吞下玻璃而不伤身体''']
            _UpperCamelCase														=    [''' 能吞虾玻璃而 不霜身体啦''']
            # S = 3, D = 2, I = 0, N = 11, CER = 5 / 11
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.4_545_454_545   ) < 1E-6   )

            _UpperCamelCase														=    ['''我能吞下玻璃''', '''而不伤身体''']
            _UpperCamelCase														=    ['''我    能 吞 下 玻 璃''', '''而不伤身体''']
            # S = 0, D = 5, I = 0, N = 11, CER = 5 / 11
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertTrue(abs(char_error_rate - 0.454_545_454_545   ) < 1E-6   )

            _UpperCamelCase														=    ['''我能吞下玻璃而不伤身体''']
            _UpperCamelCase														=    cer.compute(predictions=A,							references=A   )
            self.assertFalse(A,							0.0   )



     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    ['''''']
            _UpperCamelCase														=    ['''Hypothesis''']
            with self.assertRaises(A   ):
                   cer.compute(predictions=A,							references=A   )


if __name__ == "__main__":
       unittest.main()













def      SCREAMING_SNAKE_CASE      (   lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       ):
       _UpperCamelCase														=    index
       _UpperCamelCase														=    2 * index + 1
       _UpperCamelCase														=    2 * index + 2
       if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
              _UpperCamelCase														=    left_index

       if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
              _UpperCamelCase														=    right_index

       if largest != index:
              _UpperCamelCase							,		_UpperCamelCase														=    unsorted[index], unsorted[largest]
              heapify(lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       )


def      SCREAMING_SNAKE_CASE      (   lowerCAmelCase       ):
       _UpperCamelCase														=    len(lowerCAmelCase       )
       for i in range(n // 2 - 1     ,							-1     ,							-1       ):
              heapify(lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       )
       for i in range(n - 1     ,							0     ,							-1       ):
              _UpperCamelCase							,		_UpperCamelCase														=    unsorted[i], unsorted[0]
              heapify(lowerCAmelCase     ,							0     ,							lowerCAmelCase       )
       return unsorted


if __name__ == "__main__":
       lowercase     :			Union[str, Any]     						=	input("""Enter numbers separated by a comma:\n""").strip()
       lowercase     :			Dict     						=	[int(item) for item in user_input.split(""",""")]
       print(heap_sort(unsorted))






