

'''simple docstring'''
import unittest

from cer import CER


_lowerCamelCase	 =			CER()
class  _snake_case						(unittest.TestCase):






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	Dict      =   ["White House"]
				UpperCAmelCase_			:	Union[str, Any]      =   ["white house"]
				# S = 2, D = 0, I = 0, N = 11, CER = 2 / 11
				UpperCAmelCase_			:	Optional[Any]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.1818181818			) < 1E-6			)






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	str      =   ["were wolf"]
				UpperCAmelCase_			:	Any      =   ["werewolf"]
				# S = 0, D = 0, I = 1, N = 9, CER = 1 / 9
				UpperCAmelCase_			:	Optional[Any]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.1111111			) < 1E-6			)

				UpperCAmelCase_			:	Optional[Any]      =   ["werewolf"]
				UpperCAmelCase_			:	Union[str, Any]      =   ["weae     wolf"]
				# S = 1, D = 1, I = 0, N = 8, CER = 0.25
				UpperCAmelCase_			:	List[Any]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.25			) < 1E-6			)

				# consecutive whitespaces case 1
				UpperCAmelCase_			:	Optional[int]      =   ["were wolf"]
				UpperCAmelCase_			:	int      =   ["were               wolf"]
				# S = 0, D = 0, I = 0, N = 9, CER = 0
				UpperCAmelCase_			:	Optional[Any]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.0			) < 1E-6			)

				# consecutive whitespaces case 2
				UpperCAmelCase_			:	Tuple      =   ["were   wolf"]
				UpperCAmelCase_			:	Union[str, Any]      =   ["were               wolf"]
				# S = 0, D = 0, I = 0, N = 9, CER = 0
				UpperCAmelCase_			:	List[str]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.0			) < 1E-6			)






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	Optional[Any]      =   ["werewolf"]
				UpperCAmelCase_			:	Union[str, Any]      =   ["weaewolf"]
				# S = 1, D = 0, I = 0, N = 8, CER = 0.125
				UpperCAmelCase_			:	Union[str, Any]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.125			) < 1E-6			)






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	Any      =   ["werewolf"]
				UpperCAmelCase_			:	Dict      =   ["wereawolf"]
				# S = 0, D = 1, I = 0, N = 8, CER = 0.125
				UpperCAmelCase_			:	List[Any]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.125			) < 1E-6			)






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	str      =   ["werewolf"]
				UpperCAmelCase_			:	int      =   ["wereolf"]
				# S = 0, D = 0, I = 1, N = 8, CER = 0.125
				UpperCAmelCase_			:	str      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.125			) < 1E-6			)






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	List[Any]      =   ["werewolf"]
				UpperCAmelCase_			:	int      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertEqual(_snake_case       ,0.0			)






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	Optional[int]      =   ["werewolf", "I am your father"]
				UpperCAmelCase_			:	List[Any]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertEqual(_snake_case       ,0.0			)

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






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	Any      =   ["My hovercraft", "is full of eels"]
				UpperCAmelCase_			:	str      =   ["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_			:	int      =   cer.compute(predictions=_snake_case       ,references=_snake_case       ,concatenate_texts=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.071428			) < 1E-6			)






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	Tuple      =   ["我能吞下玻璃而不伤身体"]
				UpperCAmelCase_			:	Any      =   [" 能吞虾玻璃而 不霜身体啦"]
				# S = 3, D = 2, I = 0, N = 11, CER = 5 / 11
				UpperCAmelCase_			:	int      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.4545454545			) < 1E-6			)

				UpperCAmelCase_			:	Optional[Any]      =   ["我能吞下玻璃", "而不伤身体"]
				UpperCAmelCase_			:	List[str]      =   ["我    能 吞 下 玻 璃", "而不伤身体"]
				# S = 0, D = 5, I = 0, N = 11, CER = 5 / 11
				UpperCAmelCase_			:	Union[str, Any]      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertTrue(abs(char_error_rate - 0.454545454545			) < 1E-6			)

				UpperCAmelCase_			:	Any      =   ["我能吞下玻璃而不伤身体"]
				UpperCAmelCase_			:	Dict      =   cer.compute(predictions=_snake_case       ,references=_snake_case			)
				self.assertFalse(_snake_case       ,0.0			)






			def 						UpperCamelCase__				(   self			):
				UpperCAmelCase_			:	Union[str, Any]      =   [""]
				UpperCAmelCase_			:	Any      =   ["Hypothesis"]
				with self.assertRaises(_snake_case			):
					cer.compute(predictions=_snake_case       ,references=_snake_case			)


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







'''simple docstring'''
from __future__ import annotations


def       a__    (  _SCREAMING_SNAKE_CASE					:    int							)			-> set[int]:


	"""simple docstring"""





	UpperCAmelCase_			:	Dict      =   {1}
	UpperCAmelCase_			:	int      =   [1]
	for _ in range(2     ,							depth + 1							):
		UpperCAmelCase_			:	Dict      =   [*previous_coefficients, 0]
		UpperCAmelCase_			:	Tuple      =   [0, *previous_coefficients]
		UpperCAmelCase_			:	Dict      =   []
		for x, y in zip(_SCREAMING_SNAKE_CASE     ,							_SCREAMING_SNAKE_CASE							):
			coefficients.add(x + y							)
			previous_coefficients.append(x + y							)
	return coefficients


def       a__    (  _SCREAMING_SNAKE_CASE					:    set[int]							)			-> set[int]:


	"""simple docstring"""





	UpperCAmelCase_			:	List[Any]      =   set()
	for number in unique_coefficients:
		UpperCAmelCase_			:	Tuple      =   2
		UpperCAmelCase_			:	Tuple      =   number
		while divisor**2 <= copy_number:
			UpperCAmelCase_			:	List[Any]      =   0
			while copy_number % divisor == 0:
				copy_number //= divisor
				multiplicity += 1
			if multiplicity >= 2:
				non_squarefrees.add(_SCREAMING_SNAKE_CASE							)
				break
			divisor += 1

	return unique_coefficients.difference(_SCREAMING_SNAKE_CASE							)


def       a__    (  _SCREAMING_SNAKE_CASE					:    int = 51							)			-> int:


	"""simple docstring"""





	UpperCAmelCase_			:	Optional[Any]      =   get_pascal_triangle_unique_coefficients(_SCREAMING_SNAKE_CASE							)
	UpperCAmelCase_			:	Union[str, Any]      =   get_squarefrees(_SCREAMING_SNAKE_CASE							)
	return sum(_SCREAMING_SNAKE_CASE							)


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




