


from ...processing_utils import ProcessorMixin







class        lowerCamelCase__	(							lowercase_      ):






   """simple docstring"""






   _UpperCamelCase		:					str    =		'''WhisperFeatureExtractor'''
   _UpperCamelCase		:					int    =		'''WhisperTokenizer'''




   def __init__(							self      ,						snake_case      ,						snake_case     ):

      '''simple docstring'''


      super().__init__(UpperCamelCase__      ,						UpperCamelCase__     )
      UpperCamelCase__					=       self.feature_extractor
      UpperCamelCase__					=       False




   def 				snake_case__				(							self      ,						snake_case=None      ,						snake_case=None      ,						snake_case=True     ):

      '''simple docstring'''


      return self.tokenizer.get_decoder_prompt_ids(task=UpperCamelCase__      ,						language=UpperCamelCase__      ,						no_timestamps=UpperCamelCase__     )




   def __call__(							self      ,						*snake_case      ,						**snake_case     ):

      '''simple docstring'''


      if self._in_target_context_manager:
         return self.current_processor(*UpperCamelCase__      ,						**UpperCamelCase__     )

      UpperCamelCase__					=       kwargs.pop("audio"      ,						UpperCamelCase__     )
      UpperCamelCase__					=       kwargs.pop("sampling_rate"      ,						UpperCamelCase__     )
      UpperCamelCase__					=       kwargs.pop("text"      ,						UpperCamelCase__     )
      if len(UpperCamelCase__     ) > 0:
         UpperCamelCase__					=       args[0]
         UpperCamelCase__					=       args[1:]

      if audio is None and text is None:
         raise ValueError("You need to specify either an `audio` or `text` input to process."     )

      if audio is not None:
         UpperCamelCase__					=       self.feature_extractor(UpperCamelCase__      ,						*UpperCamelCase__      ,						sampling_rate=UpperCamelCase__      ,						**UpperCamelCase__     )
      if text is not None:
         UpperCamelCase__					=       self.tokenizer(UpperCamelCase__      ,						**UpperCamelCase__     )

      if text is None:
         return inputs

      elif audio is None:
         return encodings
      else:
         UpperCamelCase__					=       encodings["input_ids"]
         return inputs




   def 				snake_case__				(							self      ,						*snake_case      ,						**snake_case     ):

      '''simple docstring'''


      return self.tokenizer.batch_decode(*UpperCamelCase__      ,						**UpperCamelCase__     )




   def 				snake_case__				(							self      ,						*snake_case      ,						**snake_case     ):

      '''simple docstring'''


      return self.tokenizer.decode(*UpperCamelCase__      ,						**UpperCamelCase__     )







   def 				snake_case__				(							self      ,						snake_case      ,						snake_case="np"     ):

      '''simple docstring'''


      return self.tokenizer.get_prompt_ids(UpperCamelCase__      ,						return_tensors=UpperCamelCase__     )






def        UpperCamelCase_(				_A   :str  )->		str:
			UpperCamelCase__					=       ""
			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        UpperCamelCase_(				_A   :str  )->		dict[str, str]:
			UpperCamelCase__					=       [chr(i + 65  ) for i in range(26  )]
			# Remove duplicate characters from key
			UpperCamelCase__					=       remove_duplicates(key.upper()  )
			UpperCamelCase__					=       len(_A  )
			# First fill cipher with key characters
			UpperCamelCase__					=       {alphabet[i]: char for i, char in enumerate(_A  )}
			# Then map remaining characters in alphabet to
			# the alphabet from the beginning
			for i in range(len(_A  )				,     26  ):
						UpperCamelCase__					=       alphabet[i - offset]
						# Ensure we are not mapping letters to letters previously mapped
						while char in key:
									offset -= 1
									UpperCamelCase__					=       alphabet[i - offset]
						UpperCamelCase__					=       char
			return cipher_alphabet
def        UpperCamelCase_(				_A   :str				,     _A   :dict[str, str]  )->		str:
			return "".join(cipher_map.get(_A				,     _A  ) for ch in message.upper()  )
def        UpperCamelCase_(				_A   :str				,     _A   :dict[str, str]  )->		str:
			UpperCamelCase__					=       {v: k for k, v in cipher_map.items()}
			return "".join(rev_cipher_map.get(_A				,     _A  ) for ch in message.upper()  )
def        UpperCamelCase_(				)->		None:
			UpperCamelCase__					=       input("Enter message to encode or decode: "  ).strip()
			UpperCamelCase__					=       input("Enter keyword: "  ).strip()
			UpperCamelCase__					=       input("Encipher or decipher? E/D:"  ).strip()[0].lower()
			try:
						UpperCamelCase__					=       {"e": encipher, "d": decipher}[option]
			except KeyError:
						raise KeyError("invalid input option"  )
			UpperCamelCase__					=       create_cipher_map(_A  )
			print(func(_A				,     _A  )  )


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						main()


