


import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin







class 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						'MCTCTFeatureExtractor'
							_UpperCAmelCase      =						'AutoTokenizer'






							def __init__(      self			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										super().__init__(lowerCAmelCase__			,						lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     Tuple					=					self.feature_extractor
										SCREAMING_SNAKE_CASE_		:     str					=					False






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





										"""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.'       )
													SCREAMING_SNAKE_CASE_		:     Any					=					kwargs.pop('raw_speech'       )
										else:
													SCREAMING_SNAKE_CASE_		:     Tuple					=					kwargs.pop('audio'			,						lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     int					=					kwargs.pop('sampling_rate'			,						lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     str					=					kwargs.pop('text'			,						lowerCAmelCase__       )
										if len(lowerCAmelCase__       ) > 0:
													SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					args[0]
													SCREAMING_SNAKE_CASE_		:     str					=					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:
													SCREAMING_SNAKE_CASE_		:     Any					=					self.feature_extractor(lowerCAmelCase__			,						*lowerCAmelCase__			,						sampling_rate=lowerCAmelCase__			,						**lowerCAmelCase__       )
										if text is not None:
													SCREAMING_SNAKE_CASE_		:     int					=					self.tokenizer(lowerCAmelCase__			,						**lowerCAmelCase__       )

										if text is None:
													return inputs
										elif audio is None:
													return encodings
										else:
													SCREAMING_SNAKE_CASE_		:     Optional[int]					=					encodings['input_ids']
													return inputs






							def 					UpperCamelCase__     (      self			,						*lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




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






							def 					UpperCamelCase__     (      self			,						*lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




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

										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					kwargs.pop('input_features'			,						lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     int					=					kwargs.pop('labels'			,						lowerCAmelCase__       )
										if len(lowerCAmelCase__       ) > 0:
													SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					args[0]
													SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					args[1:]

										if input_features is not None:
													SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					self.feature_extractor.pad(lowerCAmelCase__			,						*lowerCAmelCase__			,						**lowerCAmelCase__       )
										if labels is not None:
													SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					self.tokenizer.pad(lowerCAmelCase__			,						**lowerCAmelCase__       )

										if labels is None:
													return input_features
										elif input_features is None:
													return labels
										else:
													SCREAMING_SNAKE_CASE_		:     Optional[int]					=					labels['input_ids']
													return input_features






							def 					UpperCamelCase__     (      self			,						*lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




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






							@contextmanager
							def 					UpperCamelCase__     (      self       ):





										"""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.'       )
										SCREAMING_SNAKE_CASE_		:     str					=					True
										SCREAMING_SNAKE_CASE_		:     str					=					self.tokenizer
										yield
										SCREAMING_SNAKE_CASE_		:     List[str]					=					self.feature_extractor
										SCREAMING_SNAKE_CASE_		:     Dict					=					False









import numpy as np
def 							UpperCamelCase_(					_A :np.array	)->		np.array:
			return 1 / (1 + np.exp(-vector	))


if __name__ == "__main__":
						import doctest

						doctest.testmod()


