



"""simple docstring"""






import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin

class        __SCREAMING_SNAKE_CASE	(      lowerCAmelCase_   ):


					'''simple docstring'''





					_a   			=							'MCTCTFeatureExtractor'
					_a   			=							'AutoTokenizer'



					def __init__(       self							:  Tuple,  lowerCamelCase							:  List[Any],  lowerCamelCase							:  Optional[int]     )->					Union[str, Any]:
								super().__init__(lowerCamelCase,  lowerCamelCase     )
								lowerCamelCase__		:		int			=self.feature_extractor
								lowerCamelCase__		:		Optional[int]			=False



					def __call__(       self							:  List[str],  *lowerCamelCase							:  Dict,  **lowerCamelCase							:  Optional[Any]     )->					Union[str, Any]:
								# For backward compatibility
								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.'''     )
											lowerCamelCase__		:		List[str]			=kwargs.pop('''raw_speech'''     )
								else:
											lowerCamelCase__		:		List[Any]			=kwargs.pop('''audio''',  lowerCamelCase     )
								lowerCamelCase__		:		Optional[Any]			=kwargs.pop('''sampling_rate''',  lowerCamelCase     )
								lowerCamelCase__		:		Dict			=kwargs.pop('''text''',  lowerCamelCase     )
								if len(lowerCamelCase     ) > 0:
											lowerCamelCase__		:		Any			=args[0]
											lowerCamelCase__		:		Any			=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:
											lowerCamelCase__		:		Union[str, Any]			=self.feature_extractor(lowerCamelCase,  *lowerCamelCase,  sampling_rate=lowerCamelCase,  **lowerCamelCase     )
								if text is not None:
											lowerCamelCase__		:		Optional[int]			=self.tokenizer(lowerCamelCase,  **lowerCamelCase     )

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



					def 		snake_case       (       self							:  Tuple,  *lowerCamelCase							:  int,  **lowerCamelCase							:  Optional[Any]     )->					Union[str, Any]:
								return self.tokenizer.batch_decode(*lowerCamelCase,  **lowerCamelCase     )



					def 		snake_case       (       self							:  int,  *lowerCamelCase							:  Tuple,  **lowerCamelCase							:  Optional[int]     )->					Tuple:
								# For backward compatibility
								if self._in_target_context_manager:
											return self.current_processor.pad(*lowerCamelCase,  **lowerCamelCase     )

								lowerCamelCase__		:		Optional[Any]			=kwargs.pop('''input_features''',  lowerCamelCase     )
								lowerCamelCase__		:		List[Any]			=kwargs.pop('''labels''',  lowerCamelCase     )
								if len(lowerCamelCase     ) > 0:
											lowerCamelCase__		:		Tuple			=args[0]
											lowerCamelCase__		:		List[str]			=args[1:]

								if input_features is not None:
											lowerCamelCase__		:		Tuple			=self.feature_extractor.pad(lowerCamelCase,  *lowerCamelCase,  **lowerCamelCase     )
								if labels is not None:
											lowerCamelCase__		:		Any			=self.tokenizer.pad(lowerCamelCase,  **lowerCamelCase     )

								if labels is None:
											return input_features
								elif input_features is None:
											return labels
								else:
											lowerCamelCase__		:		str			=labels['''input_ids''']
											return input_features



					def 		snake_case       (       self							:  Optional[Any],  *lowerCamelCase							:  Optional[Any],  **lowerCamelCase							:  Union[str, Any]     )->					int:
								return self.tokenizer.decode(*lowerCamelCase,  **lowerCamelCase     )




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









"""simple docstring"""






class        __SCREAMING_SNAKE_CASE	:


					'''simple docstring'''





					def __init__(       self							:  Dict,  lowerCamelCase							:  list     )->					None:
								lowerCamelCase__		:		Tuple			=set_counts
								lowerCamelCase__		:		Dict			=max(lowerCamelCase     )
								lowerCamelCase__		:		Union[str, Any]			=len(lowerCamelCase     )
								lowerCamelCase__		:		List[str]			=[1] * num_sets
								lowerCamelCase__		:		str			=list(range(lowerCamelCase     )     )



					def 		snake_case       (       self							:  Tuple,  lowerCamelCase							:  int,  lowerCamelCase							:  int     )->					bool:
								lowerCamelCase__		:		List[Any]			=self.get_parent(lowerCamelCase     )
								lowerCamelCase__		:		str			=self.get_parent(lowerCamelCase     )

								if src_parent == dst_parent:
											return False

								if self.ranks[dst_parent] >= self.ranks[src_parent]:
											self.set_counts[dst_parent] += self.set_counts[src_parent]
											lowerCamelCase__		:		Tuple			=0
											lowerCamelCase__		:		int			=dst_parent
											if self.ranks[dst_parent] == self.ranks[src_parent]:
														self.ranks[dst_parent] += 1
											lowerCamelCase__		:		str			=self.set_counts[dst_parent]
								else:
											self.set_counts[src_parent] += self.set_counts[dst_parent]
											lowerCamelCase__		:		List[Any]			=0
											lowerCamelCase__		:		List[str]			=src_parent
											lowerCamelCase__		:		Dict			=self.set_counts[src_parent]

								lowerCamelCase__		:		str			=max(self.max_set,  lowerCamelCase     )
								return True




					def 		snake_case       (       self							:  Union[str, Any],  lowerCamelCase							:  int     )->					int:
								if self.parents[disj_set] == disj_set:
											return disj_set
								lowerCamelCase__		:		Tuple			=self.get_parent(self.parents[disj_set]     )
								return self.parents[disj_set]




