import unittest

from transformers import RoFormerTokenizer, RoFormerTokenizerFast
from transformers.testing_utils import require_rjieba, require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin







@require_rjieba
@require_tokenizers
class __snake_case    (						lowerCamelCase_       ,		unittest.TestCase		):
			lowerCAmelCase_														=							RoFormerTokenizer
			lowerCAmelCase_														=							RoFormerTokenizerFast
			lowerCAmelCase_														=							True
			lowerCAmelCase_														=							True




			def      __a						(   self      :    List[Any]				):



					"""simple docstring"""






					super().setUp()




			def      __a						(   self      :    Optional[Any]	,     **_lowercase      :    Union[str, Any]				):



					"""simple docstring"""






					return self.tokenizer_class.from_pretrained("""junnyu/roformer_chinese_base"""	,     **_lowercase				)




			def      __a						(   self      :    Any	,     **_lowercase      :    Union[str, Any]				):



					"""simple docstring"""






					return self.rust_tokenizer_class.from_pretrained("""junnyu/roformer_chinese_base"""	,     **_lowercase				)




			def      __a						(   self      :    Dict				):



					"""simple docstring"""






					SCREAMING_SNAKE_CASE__      							=				"""永和服装饰品有限公司,今天天气非常好"""
					SCREAMING_SNAKE_CASE__      							=				"""永和 服装 饰品 有限公司 , 今 天 天 气 非常 好"""
					return input_text, output_text




			def      __a						(   self      :    Union[str, Any]				):



					"""simple docstring"""






					SCREAMING_SNAKE_CASE__      							=				self.get_tokenizer()
					SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__      							=				self.get_chinese_input_output_texts()
					SCREAMING_SNAKE_CASE__      							=				tokenizer.tokenize(_lowercase				)

					self.assertListEqual(_lowercase	,     output_text.split()				)

					SCREAMING_SNAKE_CASE__      							=				tokens + [tokenizer.unk_token]
					SCREAMING_SNAKE_CASE__      							=				[2_29_43, 2_13_32, 3_44_31, 4_59_04, 1_17, 3_06, 12_31, 12_31, 26_53, 3_39_94, 12_66, 1_00]
					self.assertListEqual(tokenizer.convert_tokens_to_ids(_lowercase				)	,     _lowercase				)




			def      __a						(   self      :    Tuple				):



					"""simple docstring"""






					SCREAMING_SNAKE_CASE__      							=				self.get_rust_tokenizer()
					SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__      							=				self.get_chinese_input_output_texts()
					SCREAMING_SNAKE_CASE__      							=				tokenizer.tokenize(_lowercase				)
					self.assertListEqual(_lowercase	,     output_text.split()				)
					SCREAMING_SNAKE_CASE__      							=				tokens + [tokenizer.unk_token]
					SCREAMING_SNAKE_CASE__      							=				[2_29_43, 2_13_32, 3_44_31, 4_59_04, 1_17, 3_06, 12_31, 12_31, 26_53, 3_39_94, 12_66, 1_00]
					self.assertListEqual(tokenizer.convert_tokens_to_ids(_lowercase				)	,     _lowercase				)




			def      __a						(   self      :    Dict				):



					"""simple docstring"""






					pass




			def      __a						(   self      :    Dict				):



					"""simple docstring"""






					pass




			def      __a						(   self      :    List[str]				):



					"""simple docstring"""






					pass

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__lowerCamelCase      :			Optional[int]							       =		{
    '''configuration_whisper''': ['''WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''WhisperConfig''', '''WhisperOnnxConfig'''],
    '''feature_extraction_whisper''': ['''WhisperFeatureExtractor'''],
    '''processing_whisper''': ['''WhisperProcessor'''],
    '''tokenization_whisper''': ['''WhisperTokenizer'''],
}

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __lowerCamelCase      :			Optional[Any]							       =		['''WhisperTokenizerFast''']

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __lowerCamelCase      :			Any							       =		[
       '''WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''WhisperForConditionalGeneration''',
       '''WhisperModel''',
       '''WhisperPreTrainedModel''',
       '''WhisperForAudioClassification''',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __lowerCamelCase      :			Tuple							       =		[
       '''TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''TFWhisperForConditionalGeneration''',
       '''TFWhisperModel''',
       '''TFWhisperPreTrainedModel''',
   ]

try:
   if not is_flax_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __lowerCamelCase      :			List[Any]							       =		[
       '''FlaxWhisperForConditionalGeneration''',
       '''FlaxWhisperModel''',
       '''FlaxWhisperPreTrainedModel''',
       '''FlaxWhisperForAudioClassification''',
   ]


if TYPE_CHECKING:
   from .configuration_whisper import WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP, WhisperConfig, WhisperOnnxConfig
   from .feature_extraction_whisper import WhisperFeatureExtractor
   from .processing_whisper import WhisperProcessor
   from .tokenization_whisper import WhisperTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_whisper_fast import WhisperTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_whisper import (
          WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
          WhisperForAudioClassification,
          WhisperForConditionalGeneration,
          WhisperModel,
          WhisperPreTrainedModel,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_whisper import (
          TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFWhisperForConditionalGeneration,
          TFWhisperModel,
          TFWhisperPreTrainedModel,
      )

   try:
      if not is_flax_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_flax_whisper import (
          FlaxWhisperForAudioClassification,
          FlaxWhisperForConditionalGeneration,
          FlaxWhisperModel,
          FlaxWhisperPreTrainedModel,
      )

else:
   import sys

   __lowerCamelCase      :			Tuple							       =		_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
