code: 
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  
  
  import unittest
  
  from cer import CER
  
  
  _lowerCamelCase							:		Any										=						CER()
  
  
  
  
  
  class   lowerCamelCase_							( unittest.TestCase							):
  
  
  
  
  					'''simple docstring'''
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = ["White House"]
  							_snake_case			 = ["white house"]
  							# S = 2, D = 0, I = 0, N = 11, CER = 2 / 11
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.18_18_18_18_18				) < 1E-6				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = ["were wolf"]
  							_snake_case			 = ["werewolf"]
  							# S = 0, D = 0, I = 1, N = 9, CER = 1 / 9
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.1_11_11_11				) < 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=__UpperCamelCase,						references=__UpperCamelCase				)
  							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=__UpperCamelCase,						references=__UpperCamelCase				)
  							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=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.0				) < 1E-6				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = ["werewolf"]
  							_snake_case			 = ["weaewolf"]
  							# S = 1, D = 0, I = 0, N = 8, CER = 0.125
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.1_25				) < 1E-6				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = ["werewolf"]
  							_snake_case			 = ["wereawolf"]
  							# S = 0, D = 1, I = 0, N = 8, CER = 0.125
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.1_25				) < 1E-6				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = ["werewolf"]
  							_snake_case			 = ["wereolf"]
  							# S = 0, D = 0, I = 1, N = 8, CER = 0.125
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.1_25				) < 1E-6				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = ["werewolf"]
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertEqual(__UpperCamelCase,						0.0				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = ["werewolf", "I am your father"]
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertEqual(__UpperCamelCase,						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=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.03_57_14_28				) < 1E-6				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_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=__UpperCamelCase,						references=__UpperCamelCase,						concatenate_texts=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.07_14_28				) < 1E-6				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = ["我能吞下玻璃而不伤身体"]
  							_snake_case			 = [" 能吞虾玻璃而 不霜身体啦"]
  							# S = 3, D = 2, I = 0, N = 11, CER = 5 / 11
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.45_45_45_45_45				) < 1E-6				)
  
  							_snake_case			 = ["我能吞下玻璃", "而不伤身体"]
  							_snake_case			 = ["我    能 吞 下 玻 璃", "而不伤身体"]
  							# S = 0, D = 5, I = 0, N = 11, CER = 5 / 11
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertTrue(abs(char_error_rate - 0.45_45_45_45_45_45				) < 1E-6				)
  
  							_snake_case			 = ["我能吞下玻璃而不伤身体"]
  							_snake_case			 = cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  							self.assertFalse(__UpperCamelCase,						0.0				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = [""]
  							_snake_case			 = ["Hypothesis"]
  							with self.assertRaises(__UpperCamelCase				):
  									cer.compute(predictions=__UpperCamelCase,						references=__UpperCamelCase				)
  
  
  if __name__ == "__main__":
  						unittest.main()
  
  
  
  
  
  
style_context: 
  
  
  
  
  '''simple docstring'''
  
  
  
  
  
  
  
  from __future__ import annotations
  
  from collections.abc import Iterable, Iterator
  from typing import Any, Generic, TypeVar
  
  _lowerCamelCase							:		List[str]										=						TypeVar('T', bound=bool)
  
  
  
  
  
  class   lowerCamelCase_							( Generic[T]							):
  
  
  
  
  					'''simple docstring'''
  
  
  
  
  
  
  					def __init__(					self,						__UpperCamelCase				):
  							_snake_case			 = value
  							_snake_case			 = None
  							_snake_case			 = None
  
  
  
  
  
  
  					@property
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							return self._value
  
  
  
  
  
  
  					@staticmethod
  					def        __SCREAMING_SNAKE_CASE			(					__UpperCamelCase,						__UpperCamelCase				):
  							if not roota:
  									return roota
  
  							if not roota:
  									return roota
  
  							if roota.value > roota.value:
  									_snake_case ,					_snake_case			 = roota, roota
  
  							_snake_case			 = roota
  							_snake_case			 = roota.right
  							_snake_case			 = roota.left
  							_snake_case			 = SkewNode.merge(__UpperCamelCase,						__UpperCamelCase				)
  
  							return result
  
  
  
  
  
  class   lowerCamelCase_							( Generic[T]							):
  
  
  
  
  					'''simple docstring'''
  
  
  
  
  
  
  					def __init__(					self,						__UpperCamelCase = ()				):
  							_snake_case			 = None
  							if data:
  									for item in data:
  											self.insert(__UpperCamelCase				)
  
  
  
  
  
  
  					def __bool__(					self				):
  							return self._root is not None
  
  
  
  
  
  
  					def __iter__(					self				):
  							_snake_case			 = []
  							while self:
  									result.append(self.pop()				)
  
  							# Pushing items back to the heap not to clear it.
  							for item in result:
  									self.insert(__UpperCamelCase				)
  
  							return iter(__UpperCamelCase				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self,						__UpperCamelCase				):
  							_snake_case			 = SkewNode.merge(self._root,						SkewNode(__UpperCamelCase				)				)
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = self.top()
  							_snake_case			 = (
  							    SkewNode.merge(self._root.left,						self._root.right				) if self._root else None
  							)
  
  							return result
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							if not self._root:
  									raise IndexError("Can't get top element for the empty heap."				)
  							return self._root.value
  
  
  
  
  
  
  					def        __SCREAMING_SNAKE_CASE			(					self				):
  							_snake_case			 = None
  
  
  if __name__ == "__main__":
  						import doctest
  
  						doctest.testmod()
  
  
  
  
  
  