



'''simple docstring'''



from __future__ import annotations

from typing import Generic, TypeVar

__UpperCamelCase      :       int      			=      TypeVar("""T""")
class 							__SCREAMING_SNAKE_CASE       (							Generic[T]     ):




      def __init__(  self ,   lowerCamelCase      )							->Optional[Any]:



         '''simple docstring'''
         __a				     =    data
         __a				     =    self
         __a				     =    0







class 							__SCREAMING_SNAKE_CASE       (							Generic[T]     ):




      def __init__(  self      )							->Union[str, Any]:



         '''simple docstring'''
         __a				     =    {}




      def  __UpperCamelCase							(  self ,   lowerCamelCase      )							->List[str]:



         '''simple docstring'''
         __a				     =    DisjointSetTreeNode(__lowerCAmelCase      )




      def  __UpperCamelCase							(  self ,   lowerCamelCase      )							->List[str]:



         '''simple docstring'''
         __a				     =    self.map[data]
         if elem_ref != elem_ref.parent:
            __a				     =    self.find_set(elem_ref.parent.data      )
         return elem_ref.parent




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase      )							->str:



         '''simple docstring'''







         if nodea.rank > nodea.rank:
            __a				     =    nodea
         else:
            __a				     =    nodea
            if nodea.rank == nodea.rank:
               nodea.rank += 1






      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase      )							->Union[str, Any]:



         '''simple docstring'''
         self.link(self.find_set(__lowerCAmelCase      ) ,   self.find_set(__lowerCAmelCase      )      )







class 							__SCREAMING_SNAKE_CASE       (							Generic[T]     ):




      def __init__(  self      )							->List[Any]:



         '''simple docstring'''
         __a				     =    {}




      def  __UpperCamelCase							(  self ,   lowerCamelCase      )							->Optional[Any]:



         '''simple docstring'''







         if node not in self.connections:
            __a				     =    {}




      def  __UpperCamelCase							(  self ,   lowerCamelCase ,   lowerCamelCase ,   lowerCamelCase      )							->Union[str, Any]:



         '''simple docstring'''
         self.add_node(__lowerCAmelCase      )
         self.add_node(__lowerCAmelCase      )
         __a				     =    weight
         __a				     =    weight






      def  __UpperCamelCase							(  self      )							->int:



         '''simple docstring'''
         __a				     =    []
         __a				     =    set()
         for start in self.connections:
            for end in self.connections[start]:
               if (start, end) not in seen:
                  seen.add((end, start)      )
                  edges.append((start, end, self.connections[start][end])      )
         edges.sort(key=lambda lowerCamelCase      : x[2]      )

         # creating the disjoint set
         __a				     =    DisjointSetTree[T]()
         for node in self.connections:
            disjoint_set.make_set(__lowerCAmelCase      )

         # MST generation
         __a				     =    0
         __a				     =    0
         __a				     =    GraphUndirectedWeighted[T]()
         while num_edges < len(self.connections      ) - 1:
            __a     ,			__a     ,			__a				     =    edges[index]
            index += 1
            __a				     =    disjoint_set.find_set(__lowerCAmelCase      )
            __a				     =    disjoint_set.find_set(__lowerCAmelCase      )
            if parent_u != parent_v:
               num_edges += 1
               graph.add_edge(__lowerCAmelCase ,   __lowerCAmelCase ,   __lowerCAmelCase      )
               disjoint_set.union(__lowerCAmelCase ,   __lowerCAmelCase      )
         return graph







'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_tf_available,
    is_torch_available,
)


__UpperCamelCase      :       Optional[int]      			=      {
    """configuration_speech_to_text""": ["""SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Speech2TextConfig"""],
    """processing_speech_to_text""": ["""Speech2TextProcessor"""],
}

try:
 if not is_sentencepiece_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __UpperCamelCase      :       Union[str, Any]      			=      ["""Speech2TextTokenizer"""]

try:
 if not is_speech_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __UpperCamelCase      :       Optional[Any]      			=      ["""Speech2TextFeatureExtractor"""]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __UpperCamelCase      :       List[Any]      			=      [
     """TF_SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """TFSpeech2TextForConditionalGeneration""",
     """TFSpeech2TextModel""",
     """TFSpeech2TextPreTrainedModel""",
 ]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __UpperCamelCase      :       Tuple      			=      [
     """SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """Speech2TextForConditionalGeneration""",
     """Speech2TextModel""",
     """Speech2TextPreTrainedModel""",
 ]


if TYPE_CHECKING:
 from .configuration_speech_to_text import SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP, SpeechaTextConfig
 from .processing_speech_to_text import SpeechaTextProcessor

 try:
  if not is_sentencepiece_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_speech_to_text import SpeechaTextTokenizer

 try:
  if not is_speech_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .feature_extraction_speech_to_text import SpeechaTextFeatureExtractor

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_speech_to_text import (
      TF_SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFSpeechaTextForConditionalGeneration,
      TFSpeechaTextModel,
      TFSpeechaTextPreTrainedModel,
  )

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_speech_to_text import (
      SPEECH_TO_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
      SpeechaTextForConditionalGeneration,
      SpeechaTextModel,
      SpeechaTextPreTrainedModel,
  )

else:
 import sys

 __UpperCamelCase      :       List[str]      			=      _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)