


'''simple docstring'''






import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, Features, Value
from .base import TaskTemplate






@dataclass(frozen=lowerCAmelCase							)
class    __magic_name__				(						lowerCAmelCase							):
       UpperCAmelCase		 =field(default="automatic-speech-recognition"   ,metadata={"include_in_asdict_even_if_is_default": True}							)
       UpperCAmelCase		 =Features({"audio": Audio()}							)
       UpperCAmelCase		 =Features({"transcription": Value("string"							)}							)
       UpperCAmelCase		 ="audio"
       UpperCAmelCase		 ="transcription"






       def      lowerCAmelCase						(     self    ,				snake_case)		->    Dict:




          '''simple docstring'''
          if self.audio_column not in features:
             raise ValueError(f"Column {self.audio_column} is not present in features.")
          if not isinstance(features[self.audio_column]    ,				snake_case):
             raise ValueError(f"Column {self.audio_column} is not an Audio type.")
          _UpperCAmelCase  :  Any				       =copy.deepcopy(self)
          _UpperCAmelCase  :  str				       =self.input_schema.copy()
          _UpperCAmelCase  :  Optional[Any]				       =features[self.audio_column]
          _UpperCAmelCase  :  Optional[Any]				       =input_schema
          return task_template






       @property
       def      lowerCAmelCase						(     self)		->    Dict[str, str]:




          '''simple docstring'''
          return {self.audio_column: "audio", self.transcription_column: "transcription"}





'''simple docstring'''






def lowerCamelCase__     (		__lowerCamelCase			:				str				):







   '''simple docstring'''




   _UpperCAmelCase  :  Dict				       =''
   for ch in key:
      if ch == " " or ch not in key_no_dups and ch.isalpha():
         key_no_dups += ch
   return key_no_dups





def lowerCamelCase__     (		__lowerCamelCase			:				str				):







   '''simple docstring'''




   _UpperCAmelCase  :  List[str]				       =[chr(i + 6_5				) for i in range(2_6				)]
   # Remove duplicate characters from key
   _UpperCAmelCase  :  Any				       =remove_duplicates(key.upper()				)
   _UpperCAmelCase  :  Optional[Any]				       =len(__lowerCamelCase				)
   # First fill cipher with key characters
   _UpperCAmelCase  :  List[Any]				       ={alphabet[i]: char for i, char in enumerate(__lowerCamelCase				)}
   # Then map remaining characters in alphabet to
   # the alphabet from the beginning
   for i in range(len(__lowerCamelCase				)			,       2_6				):
      _UpperCAmelCase  :  Union[str, Any]				       =alphabet[i - offset]
      # Ensure we are not mapping letters to letters previously mapped
      while char in key:
         offset -= 1
         _UpperCAmelCase  :  str				       =alphabet[i - offset]
      _UpperCAmelCase  :  Any				       =char
   return cipher_alphabet





def lowerCamelCase__     (		__lowerCamelCase			:				str			,       __lowerCamelCase			:				dict[str, str]				):







   '''simple docstring'''




   return "".join(cipher_map.get(__lowerCamelCase			,       __lowerCamelCase				) for ch in message.upper()				)





def lowerCamelCase__     (		__lowerCamelCase			:				str			,       __lowerCamelCase			:				dict[str, str]				):







   '''simple docstring'''




   _UpperCAmelCase  :  List[str]				       ={v: k for k, v in cipher_map.items()}
   return "".join(rev_cipher_map.get(__lowerCamelCase			,       __lowerCamelCase				) for ch in message.upper()				)





def lowerCamelCase__     (		):







   '''simple docstring'''




   _UpperCAmelCase  :  Union[str, Any]				       =input('Enter message to encode or decode: '				).strip()
   _UpperCAmelCase  :  int				       =input('Enter keyword: '				).strip()
   _UpperCAmelCase  :  int				       =input('Encipher or decipher? E/D:'				).strip()[0].lower()
   try:
      _UpperCAmelCase  :  Tuple				       ={'e': encipher, 'd': decipher}[option]
   except KeyError:
      raise KeyError('invalid input option'				)
   _UpperCAmelCase  :  List[str]				       =create_cipher_map(__lowerCamelCase				)
   print(func(__lowerCamelCase			,       __lowerCamelCase				)				)


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 main()

