






import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin


class 							__a							(  __A						):





		'''simple docstring'''



		UpperCAmelCase__      :				Optional[Any]				    =						"""MCTCTFeatureExtractor"""
		UpperCAmelCase__      :				Union[str, Any]				    =						"""AutoTokenizer"""


		def __init__(						self ,    UpperCamelCase__ ,    UpperCamelCase__       ):
						super().__init__(__a ,    __a       )
						SCREAMING_SNAKE_CASE_   :	Optional[Any]													=   self.feature_extractor
						SCREAMING_SNAKE_CASE_   :	Tuple													=   False


		def __call__(						self ,    *UpperCamelCase__ ,    **UpperCamelCase__       ):
						# For backward compatibility
						if self._in_target_context_manager:
										return self.current_processor(*__a ,    **__a       )

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

						if text is None:
										return inputs
						elif audio is None:
										return encodings
						else:
										SCREAMING_SNAKE_CASE_   :	Union[str, Any]													=   encodings['input_ids']
										return inputs


		def   __snake_case			(						self ,    *UpperCamelCase__ ,    **UpperCamelCase__       ):
						return self.tokenizer.batch_decode(*__a ,    **__a       )


		def   __snake_case			(						self ,    *UpperCamelCase__ ,    **UpperCamelCase__       ):
						# For backward compatibility
						if self._in_target_context_manager:
										return self.current_processor.pad(*__a ,    **__a       )

						SCREAMING_SNAKE_CASE_   :	Dict													=   kwargs.pop('input_features' ,    __a       )
						SCREAMING_SNAKE_CASE_   :	Dict													=   kwargs.pop('labels' ,    __a       )
						if len(__a       ) > 0:
										SCREAMING_SNAKE_CASE_   :	int													=   args[0]
										SCREAMING_SNAKE_CASE_   :	List[Any]													=   args[1:]

						if input_features is not None:
										SCREAMING_SNAKE_CASE_   :	int													=   self.feature_extractor.pad(__a ,    *__a ,    **__a       )
						if labels is not None:
										SCREAMING_SNAKE_CASE_   :	str													=   self.tokenizer.pad(__a ,    **__a       )

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


		def   __snake_case			(						self ,    *UpperCamelCase__ ,    **UpperCamelCase__       ):
						return self.tokenizer.decode(*__a ,    **__a       )






		@contextmanager
		def   __snake_case			(						self       ):
						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_   :	Optional[Any]													=   True
						SCREAMING_SNAKE_CASE_   :	Union[str, Any]													=   self.tokenizer
						yield
						SCREAMING_SNAKE_CASE_   :	Dict													=   self.feature_extractor
						SCREAMING_SNAKE_CASE_   :	List[Any]													=   False










import copy
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Optional, Union


@dataclass
class 							__a							:





		'''simple docstring'''



		UpperCAmelCase__      :				Optional[Union[str, Path]]				    =						None
		UpperCAmelCase__      :				bool				    =						False
		UpperCAmelCase__      :				bool				    =						False
		UpperCAmelCase__      :				bool				    =						False
		UpperCAmelCase__      :				Optional[Dict]				    =						None
		UpperCAmelCase__      :				Optional[str]				    =						None
		UpperCAmelCase__      :				bool				    =						False
		UpperCAmelCase__      :				bool				    =						False
		UpperCAmelCase__      :				bool				    =						False
		UpperCAmelCase__      :				bool				    =						True
		UpperCAmelCase__      :				Optional[int]				    =						None
		UpperCAmelCase__      :				int				    =						1
		UpperCAmelCase__      :				Optional[Union[str, bool]]				    =						None
		UpperCAmelCase__      :				bool				    =						False
		UpperCAmelCase__      :				Optional[Dict]				    =						None
		UpperCAmelCase__      :				Optional[str]				    =						None


		def   __snake_case			(						self       ):
						return self.__class__(**{k: copy.deepcopy(UpperCamelCase__       ) for k, v in self.__dict__.items()}       )