




from ...processing_utils import ProcessorMixin


class        UpperCamelCase_					(				UpperCAmelCase__  ):

    '''simple docstring'''






    UpperCAmelCase__													=   '''WhisperFeatureExtractor'''
    UpperCAmelCase__													=   '''WhisperTokenizer'''


    def __init__(    self   :			Tuple      ,				UpperCAmelCase__   :			Dict      ,				UpperCAmelCase__   :			Optional[int])		->str:





           '''simple docstring'''

           super().__init__(UpperCAmelCase__      ,				UpperCAmelCase__)
           A__   				=					self.feature_extractor
           A__   				=					False


    def  SCREAMING_SNAKE_CASE							(    self   :			Union[str, Any]      ,				UpperCAmelCase__   :			int=None      ,				UpperCAmelCase__   :			List[Any]=None      ,				UpperCAmelCase__   :			Tuple=True)		->Dict:





           '''simple docstring'''

           return self.tokenizer.get_decoder_prompt_ids(task=UpperCAmelCase__      ,				language=UpperCAmelCase__      ,				no_timestamps=UpperCAmelCase__)


    def __call__(    self   :			Optional[Any]      ,				*UpperCAmelCase__   :			Dict      ,				**UpperCAmelCase__   :			str)		->int:





           '''simple docstring'''

           if self._in_target_context_manager:
                  return self.current_processor(*UpperCAmelCase__      ,				**UpperCAmelCase__)

           A__   				=					kwargs.pop('''audio'''      ,				UpperCAmelCase__)
           A__   				=					kwargs.pop('''sampling_rate'''      ,				UpperCAmelCase__)
           A__   				=					kwargs.pop('''text'''      ,				UpperCAmelCase__)
           if len(UpperCAmelCase__) > 0:
                  A__   				=					args[0]
                  A__   				=					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:
                  A__   				=					self.feature_extractor(UpperCAmelCase__      ,				*UpperCAmelCase__      ,				sampling_rate=UpperCAmelCase__      ,				**UpperCAmelCase__)
           if text is not None:
                  A__   				=					self.tokenizer(UpperCAmelCase__      ,				**UpperCAmelCase__)

           if text is None:
                  return inputs

           elif audio is None:
                  return encodings
           else:
                  A__   				=					encodings['''input_ids''']
                  return inputs


    def  SCREAMING_SNAKE_CASE							(    self   :			List[Any]      ,				*UpperCAmelCase__   :			Any      ,				**UpperCAmelCase__   :			Optional[Any])		->List[str]:





           '''simple docstring'''

           return self.tokenizer.batch_decode(*UpperCAmelCase__      ,				**UpperCAmelCase__)


    def  SCREAMING_SNAKE_CASE							(    self   :			Optional[Any]      ,				*UpperCAmelCase__   :			str      ,				**UpperCAmelCase__   :			List[str])		->List[str]:





           '''simple docstring'''

           return self.tokenizer.decode(*UpperCAmelCase__      ,				**UpperCAmelCase__)





    def  SCREAMING_SNAKE_CASE							(    self   :			Tuple      ,				UpperCAmelCase__   :			str      ,				UpperCAmelCase__   :			int="np")		->Optional[int]:





           '''simple docstring'''

           return self.tokenizer.get_prompt_ids(UpperCAmelCase__      ,				return_tensors=UpperCAmelCase__)








def SCREAMING_SNAKE_CASE       ( lowercase_				,       lowercase_		)     -> float:



       """simple docstring"""

       def get_matched_characters(lowercase_				,       lowercase_		) -> str:
              A__   				=					[]
              A__   				=					min(len(_stra		)				,       len(_stra		)		) // 2
              for i, l in enumerate(_stra		):
                     A__   				=					int(max(0				,       i - limit		)		)
                     A__   				=					int(min(i + limit + 1				,       len(_stra		)		)		)
                     if l in _stra[left:right]:
                            matched.append(lowercase_		)
                            A__   				=					f"""{_stra[0:_stra.index(lowercase_		)]} {_stra[_stra.index(lowercase_		) + 1:]}"""

              return "".join(lowercase_		)

       # matching characters
       A__   				=					get_matched_characters(lowercase_				,       lowercase_		)
       A__   				=					get_matched_characters(lowercase_				,       lowercase_		)
       A__   				=					len(lowercase_		)

       # transposition
       A__   				=					(
           len([(ca, ca) for ca, ca in zip(lowercase_				,       lowercase_		) if ca != ca]		) // 2
       )

       if not match_count:
              A__   				=					0.0
       else:
              A__   				=					(
                  1
                  / 3
                  * (
                      match_count / len(lowercase_		)
                      + match_count / len(lowercase_		)
                      + (match_count - transpositions) / match_count
                  )
              )

       # common prefix up to 4 characters
       A__   				=					0
       for ca, ca in zip(stra[:4]				,       stra[:4]		):
              if ca == ca:
                     prefix_len += 1
              else:
                     break

       return jaro + 0.1 * prefix_len * (1 - jaro)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  print(jaro_winkler("""hello""", """world"""))


