





"""simple docstring"""




import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin




class 				_a		(   _lowerCAmelCase       ):
				UpperCamelCase			=					'''AutoFeatureExtractor'''
				UpperCamelCase			=					'''Speech2Text2Tokenizer'''






				def __init__(				self	:					str,				lowerCAmelCase__	:					Optional[int],				lowerCAmelCase__	:					Union[str, Any]							)			->   Union[str, Any]:




										'''simple docstring'''



										super().__init__(lowerCAmelCase__,				lowerCAmelCase__							)
										_UpperCamelCase    :      Any						     =					self.feature_extractor
										_UpperCamelCase    :      Any						     =					False






				def __call__(				self	:					Optional[Any],				*lowerCAmelCase__	:					Dict,				**lowerCAmelCase__	:					Optional[int]							)			->   Dict:




										'''simple docstring'''



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

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

										if text is None:
																return inputs
										elif audio is None:
																return encodings
										else:
																_UpperCamelCase    :      List[str]						     =					encodings['''input_ids''']
																return inputs






				def        snake_case			(				self	:					Tuple,				*lowerCAmelCase__	:					Optional[int],				**lowerCAmelCase__	:					Dict							)			->   str:




										'''simple docstring'''



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






				def        snake_case			(				self	:					Optional[Any],				*lowerCAmelCase__	:					List[str],				**lowerCAmelCase__	:					Optional[Any]							)			->   Tuple:




										'''simple docstring'''



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






				@contextmanager
				def        snake_case			(				self	:					Optional[Any]							)			->   Optional[int]:




										'''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    :      Optional[Any]						     =					True
										_UpperCamelCase    :      Optional[int]						     =					self.tokenizer
										yield
										_UpperCamelCase    :      Optional[int]						     =					self.feature_extractor
										_UpperCamelCase    :      List[Any]						     =					False










"""simple docstring"""




def  a_       (							_lowercase     ):
						_UpperCamelCase    :      str						     =					len(_lowercase     )

						# Set the gap value to be decreased by a factor of 1.3
						# after each iteration
						_UpperCamelCase    :      str						     =					1.3

						# Continue sorting until the gap is 1
						while gap > 1:
												# Decrease the gap value
												_UpperCamelCase    :      Union[str, Any]						     =					int(gap / shrink     )

												# Sort the elements using insertion sort
												for i in range(_lowercase ,		len(_lowercase     )     ):
																		_UpperCamelCase    :      Optional[Any]						     =					collection[i]
																		_UpperCamelCase    :      int						     =					i
																		while j >= gap and collection[j - gap] > temp:
																								_UpperCamelCase    :      List[str]						     =					collection[j - gap]
																								j -= gap
																		_UpperCamelCase    :      Union[str, Any]						     =					temp

						return collection


if __name__ == "__main__":
						import doctest

						doctest.testmod()



