




import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin







class     __lowerCAmelCase (       __magic_name__ ):

			"""simple docstring"""







			snake_case_   		=       '''MCTCTFeatureExtractor'''
			snake_case_   		=       '''AutoTokenizer'''


			def __init__(      self			,						lowerCamelCase__			,						lowerCamelCase__							)    ->      Dict:



							'''simple docstring'''
							super().__init__(lowerCamelCase__			,						lowerCamelCase__							)
							__lowerCamelCase		       =    self.feature_extractor
							__lowerCamelCase		       =    False


			def __call__(      self			,						*lowerCamelCase__			,						**lowerCamelCase__							)    ->      Any:



							'''simple docstring'''
							# 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		       =    kwargs.pop('raw_speech'							)
							else:
											__lowerCamelCase		       =    kwargs.pop('audio'			,						lowerCamelCase__							)
							__lowerCamelCase		       =    kwargs.pop('sampling_rate'			,						lowerCamelCase__							)
							__lowerCamelCase		       =    kwargs.pop('text'			,						lowerCamelCase__							)
							if len(lowerCamelCase__							) > 0:
											__lowerCamelCase		       =    args[0]
											__lowerCamelCase		       =    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		       =    self.feature_extractor(lowerCamelCase__			,						*lowerCamelCase__			,						sampling_rate=lowerCamelCase__			,						**lowerCamelCase__							)
							if text is not None:
											__lowerCamelCase		       =    self.tokenizer(lowerCamelCase__			,						**lowerCamelCase__							)

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


			def       lowercase_    (      self			,						*lowerCamelCase__			,						**lowerCamelCase__							)    ->      int:



							'''simple docstring'''
							return self.tokenizer.batch_decode(*lowerCamelCase__			,						**lowerCamelCase__							)


			def       lowercase_    (      self			,						*lowerCamelCase__			,						**lowerCamelCase__							)    ->      str:



							'''simple docstring'''
							# For backward compatibility
							if self._in_target_context_manager:
											return self.current_processor.pad(*lowerCamelCase__			,						**lowerCamelCase__							)

							__lowerCamelCase		       =    kwargs.pop('input_features'			,						lowerCamelCase__							)
							__lowerCamelCase		       =    kwargs.pop('labels'			,						lowerCamelCase__							)
							if len(lowerCamelCase__							) > 0:
											__lowerCamelCase		       =    args[0]
											__lowerCamelCase		       =    args[1:]

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

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


			def       lowercase_    (      self			,						*lowerCamelCase__			,						**lowerCamelCase__							)    ->      List[Any]:



							'''simple docstring'''
							return self.tokenizer.decode(*lowerCamelCase__			,						**lowerCamelCase__							)






			@contextmanager
			def       lowercase_    (      self							)    ->      List[str]:



							'''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.'							)
							__lowerCamelCase		       =    True
							__lowerCamelCase		       =    self.tokenizer
							yield
							__lowerCamelCase		       =    self.feature_extractor
							__lowerCamelCase		       =    False






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__lowerCAmelCase		       =							{
    '''configuration_canine''': ['''CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CanineConfig'''],
    '''tokenization_canine''': ['''CanineTokenizer'''],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __lowerCAmelCase		       =							[
     '''CANINE_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''CanineForMultipleChoice''',
     '''CanineForQuestionAnswering''',
     '''CanineForSequenceClassification''',
     '''CanineForTokenClassification''',
     '''CanineLayer''',
     '''CanineModel''',
     '''CaninePreTrainedModel''',
     '''load_tf_weights_in_canine''',
 ]


if TYPE_CHECKING:
 from .configuration_canine import CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP, CanineConfig
 from .tokenization_canine import CanineTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_canine import (
      CANINE_PRETRAINED_MODEL_ARCHIVE_LIST,
      CanineForMultipleChoice,
      CanineForQuestionAnswering,
      CanineForSequenceClassification,
      CanineForTokenClassification,
      CanineLayer,
      CanineModel,
      CaninePreTrainedModel,
      load_tf_weights_in_canine,
  )


else:
 import sys

 __lowerCAmelCase		       =							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)


