



import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin





class UpperCAmelCase						( __A  ):


				'''simple docstring'''






				lowerCamelCase_    = '''MCTCTFeatureExtractor'''
				lowerCamelCase_    = '''AutoTokenizer'''
				def __init__(						self		,     lowercase		,     lowercase ):



						"""simple docstring"""





						super().__init__(lowercase		,     lowercase )
						A_		:    Dict         =				self.feature_extractor
						A_		:    Tuple         =				False
				def __call__(						self		,     *lowercase		,     **lowercase ):



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

						if text is None:
								return inputs
						elif audio is None:
								return encodings
						else:
								A_		:    Tuple         =				encodings['input_ids']
								return inputs
				def   lowerCAmelCase_       (						self		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





						return self.tokenizer.batch_decode(*lowercase		,     **lowercase )
				def   lowerCAmelCase_       (						self		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





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

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

						if input_features is not None:
								A_		:    List[Any]         =				self.feature_extractor.pad(lowercase		,     *lowercase		,     **lowercase )
						if labels is not None:
								A_		:    List[str]         =				self.tokenizer.pad(lowercase		,     **lowercase )

						if labels is None:
								return input_features
						elif input_features is None:
								return labels
						else:
								A_		:    int         =				labels['input_ids']
								return input_features
				def   lowerCAmelCase_       (						self		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





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







				@contextmanager
				def   lowerCAmelCase_       (						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.' )
						A_		:    Optional[int]         =				True
						A_		:    str         =				self.tokenizer
						yield
						A_		:    Any         =				self.feature_extractor
						A_		:    Dict         =				False







from ..utils import DummyObject, requires_backends





class UpperCAmelCase						( metaclass=__A  ):


				'''simple docstring'''






				lowerCamelCase_    = ['''onnx''']
				def __init__(						self		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





						requires_backends(self		,     ['onnx'] )
				@classmethod
				def   lowerCAmelCase_       (						cls		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





						requires_backends(cls		,     ['onnx'] )







				@classmethod
				def   lowerCAmelCase_       (						cls		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





						requires_backends(cls		,     ['onnx'] )






