

"""simple docstring"""






import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin







class       snake_case__  ( lowerCAmelCase_     ):
			SCREAMING_SNAKE_CASE__     				=						'''Speech2TextFeatureExtractor'''
			SCREAMING_SNAKE_CASE__     				=						'''Speech2TextTokenizer'''







			def __init__(			self			: Union[str, Any]			,  lowercase			: str			,  lowercase			: List[Any]  ):





								'''simple docstring'''



								super().__init__(lowercase			,  lowercase  )
								UpperCAmelCase			:   int      =				self.feature_extractor
								UpperCAmelCase			:   int      =				False







			def __call__(			self			: Any			,  *lowercase			: List[Any]			,  **lowercase			: Optional[Any]  ):





								'''simple docstring'''



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

								if "raw_speech" in kwargs:
													warnings.warn("Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."  )
													UpperCAmelCase			:   Dict      =				kwargs.pop("raw_speech"  )
								else:
													UpperCAmelCase			:   Any      =				kwargs.pop("audio"			,  lowercase  )
								UpperCAmelCase			:   Dict      =				kwargs.pop("sampling_rate"			,  lowercase  )
								UpperCAmelCase			:   Optional[Any]      =				kwargs.pop("text"			,  lowercase  )
								if len(lowercase  ) > 0:
													UpperCAmelCase			:   int      =				args[0]
													UpperCAmelCase			:   int      =				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			:   str      =				self.feature_extractor(lowercase			,  *lowercase			,  sampling_rate=lowercase			,  **lowercase  )
								if text is not None:
													UpperCAmelCase			:   str      =				self.tokenizer(lowercase			,  **lowercase  )

								if text is None:
													return inputs
								elif audio is None:
													return encodings
								else:
													UpperCAmelCase			:   Any      =				encodings["input_ids"]
													return inputs







			def 			__lowerCAmelCase				(			self			: Dict			,  *lowercase			: Optional[int]			,  **lowercase			: Dict  ):





								'''simple docstring'''



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







			def 			__lowerCAmelCase				(			self			: Union[str, Any]			,  *lowercase			: Tuple			,  **lowercase			: Any  ):





								'''simple docstring'''



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







			@contextmanager
			def 			__lowerCAmelCase				(			self			: Dict  ):





								'''simple docstring'''



								warnings.warn(
								    "`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your "
								    "labels by using the argument `text` of the regular `__call__` method (either in the same call as "
								    "your audio inputs, or in a separate call."  )
								UpperCAmelCase			:   Dict      =				True
								UpperCAmelCase			:   Optional[Any]      =				self.tokenizer
								yield
								UpperCAmelCase			:   List[Any]      =				self.feature_extractor
								UpperCAmelCase			:   Tuple      =				False





"""simple docstring"""






snake_case_   :   List[str]        =       6_5_5_2_1



def   lowercase_	(    _lowercase       :		str	):




					'''simple docstring'''






					UpperCAmelCase			:   Dict      =				1
					UpperCAmelCase			:   Optional[int]      =				0
					for plain_chr in plain_text:
										UpperCAmelCase			:   int      =				(a + ord(_lowercase	)) % MOD_ADLER
										UpperCAmelCase			:   str      =				(b + a) % MOD_ADLER
					return (b << 16) | a


