





"""simple docstring"""


import unittest

from cer import CER


a__					:     List[Any]							=				CER()



class      lowercase_				(     unittest.TestCase							):

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				["White House"]
        snake_case__    							=				["white house"]
        # S = 2, D = 0, I = 0, N = 11, CER = 2 / 11
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.1818181818     ) < 1e-6     )

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				["were wolf"]
        snake_case__    							=				["werewolf"]
        # S = 0, D = 0, I = 1, N = 9, CER = 1 / 9
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.1111111     ) < 1e-6     )

        snake_case__    							=				["werewolf"]
        snake_case__    							=				["weae     wolf"]
        # S = 1, D = 1, I = 0, N = 8, CER = 0.25
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.25     ) < 1e-6     )

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

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

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				["werewolf"]
        snake_case__    							=				["weaewolf"]
        # S = 1, D = 0, I = 0, N = 8, CER = 0.125
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.125     ) < 1e-6     )

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				["werewolf"]
        snake_case__    							=				["wereawolf"]
        # S = 0, D = 1, I = 0, N = 8, CER = 0.125
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.125     ) < 1e-6     )

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				["werewolf"]
        snake_case__    							=				["wereolf"]
        # S = 0, D = 0, I = 1, N = 8, CER = 0.125
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.125     ) < 1e-6     )

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				["werewolf"]
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertEqual(__SCREAMING_SNAKE_CASE   ,					0.0     )

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				["werewolf", "I am your father"]
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertEqual(__SCREAMING_SNAKE_CASE   ,					0.0     )

        snake_case__    							=				["werewolf", "I am your father", "doge"]
        snake_case__    							=				["werxwolf", "I       am your father", "doge"]
        # S = 1, D = 0, I = 0, N = 28, CER = 1 / 28
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.03571428     ) < 1e-6     )

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				["My hovercraft", "is full of eels"]
        snake_case__    							=				["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
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE   ,					concatenate_texts=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.071428     ) < 1e-6     )

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

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

        snake_case__    							=				["我能吞下玻璃", "而不伤身体"]
        snake_case__    							=				["我    能 吞 下 玻 璃", "而不伤身体"]
        # S = 0, D = 5, I = 0, N = 11, CER = 5 / 11
        snake_case__    							=				cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )
        self.assertTrue(abs(char_error_rate - 0.454545454545     ) < 1e-6     )

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

       def 		_SCREAMING_SNAKE_CASE(			self     ):






        '''simple docstring'''

        snake_case__    							=				[""]
        snake_case__    							=				["Hypothesis"]
        with self.assertRaises(__SCREAMING_SNAKE_CASE     ):
         cer.compute(predictions=__SCREAMING_SNAKE_CASE   ,					references=__SCREAMING_SNAKE_CASE     )


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








"""simple docstring"""


from math import sqrt





def 							a__			(  _UpperCAmelCase	)    ->  list[int]:

 '''simple docstring'''






 snake_case__    							=				[1]
 for i in range(2	,     int(sqrt(_UpperCAmelCase	)	) + 1	,     1	):
  if number % i == 0:
   values.append(_UpperCAmelCase	)
   if int(number // i	) != i:
    values.append(int(number // i	)	)
 return sorted(_UpperCAmelCase	)





def 							a__			(  _UpperCAmelCase	)    ->  bool:

 '''simple docstring'''






 return sum(factors(_UpperCAmelCase	)	) > n





def 							a__			(  _UpperCAmelCase	)    ->  bool:

 '''simple docstring'''






 snake_case__    							=				factors(_UpperCAmelCase	)
 snake_case__    							=				len(_UpperCAmelCase	)
 snake_case__    							=				[[0 for i in range(number + 1	)] for j in range(r + 1	)]
 for i in range(r + 1	):
  snake_case__    							=				True

 for i in range(1	,     number + 1	):
  snake_case__    							=				False

 for i in range(1	,     r + 1	):
  for j in range(1	,     number + 1	):
   if j < values[i - 1]:
    snake_case__    							=				subset[i - 1][j]
   else:
    snake_case__    							=				subset[i - 1][j] or subset[i - 1][j - values[i - 1]]

 return subset[r][number] != 0





def 							a__			(  _UpperCAmelCase	)    ->  bool:

 '''simple docstring'''






 return abundant(_UpperCAmelCase	) and not semi_perfect(_UpperCAmelCase	)


if __name__ == "__main__":
   import doctest

   doctest.testmod(verbose=True)
   for number in (6_9, 7_0, 7_1):
      print(f'''{number} is {'' if weird(number) else 'not '}weird.''')

