

'''simple docstring'''

from ...processing_utils import ProcessorMixin


class      lowerCAmelCase   (					__a      ):
       lowerCAmelCase_				=       "WhisperFeatureExtractor"
       lowerCAmelCase_				=       "WhisperTokenizer"







       def __init__(							self	:       Optional[int]  ,					__lowercase	:       Optional[int]  ,					__lowercase	:       Any					):







            """simple docstring"""







            super().__init__(_A  ,					_A					)
            __lowercase							=self.feature_extractor
            __lowercase							=False







       def 	snake_case      (							self	:       Optional[int]  ,					__lowercase	:       Any=None  ,					__lowercase	:       Optional[Any]=None  ,					__lowercase	:       Optional[Any]=True					):







            """simple docstring"""







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







       def __call__(							self	:       Any  ,					*__lowercase	:       Optional[Any]  ,					**__lowercase	:       Dict					):







            """simple docstring"""







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

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

            if text is None:
                 return inputs

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







       def 	snake_case      (							self	:       Optional[Any]  ,					*__lowercase	:       int  ,					**__lowercase	:       Any					):







            """simple docstring"""







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







       def 	snake_case      (							self	:       List[Any]  ,					*__lowercase	:       List[Any]  ,					**__lowercase	:       int					):







            """simple docstring"""







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







       def 	snake_case      (							self	:       List[str]  ,					__lowercase	:       str  ,					__lowercase	:       List[Any]="np"					):







            """simple docstring"""







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






'''simple docstring'''
import math




class 			lowerCamelCase_   :






      def lowercase_							(					self				:    Optional[Any]						,						_A				:    list[list[float]]						,						_A				:    list[int] ):


          '''simple docstring'''


          UpperCAmelCase__			:		List[str]													=				0.0
          UpperCAmelCase__			:		Union[str, Any]													=				0.0
          for i in range(len(_A ) ):
              da += math.pow((sample[i] - weights[0][i])						,						2 )
              da += math.pow((sample[i] - weights[1][i])						,						2 )
              return 0 if da > da else 1
          return 0






      def lowercase_							(					self				:    Dict						,						_A				:    list[list[int | float]]						,						_A				:    list[int]						,						_A				:    int						,						_A				:    float ):


          '''simple docstring'''


          for i in range(len(_A ) ):
              weights[j][i] += alpha * (sample[i] - weights[j][i])
          return weights





def 					a__       (					)    ->	None:
    # Training Examples ( m, n )
    UpperCAmelCase__			:		Optional[Any]													=				[[1, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 1]]

    # weight initialization ( n, C )
    UpperCAmelCase__			:		str													=				[[0.2, 0.6, 0.5, 0.9], [0.8, 0.4, 0.7, 0.3]]

    # training
    UpperCAmelCase__			:		Optional[Any]													=				SelfOrganizingMap()
    UpperCAmelCase__			:		Tuple													=				3
    UpperCAmelCase__			:		Dict													=				0.5

    for _ in range(lowerCAmelCase__						):
        for j in range(len(lowerCAmelCase__						)						):
            # training sample
            UpperCAmelCase__			:		Optional[int]													=				training_samples[j]

            # Compute the winning vector
            UpperCAmelCase__			:		str													=				self_organizing_map.get_winner(lowerCAmelCase__  ,					lowerCAmelCase__						)

            # Update the winning vector
            UpperCAmelCase__			:		int													=				self_organizing_map.update(lowerCAmelCase__  ,					lowerCAmelCase__  ,					lowerCAmelCase__  ,					lowerCAmelCase__						)

    # classify test sample
    UpperCAmelCase__			:		str													=				[0, 0, 0, 1]
    UpperCAmelCase__			:		int													=				self_organizing_map.get_winner(lowerCAmelCase__  ,					lowerCAmelCase__						)

    # results
    print(F"""Clusters that the test sample belongs to : {winner}"""						)
    print(F"""Weights that have been trained : {weights}"""						)


# running the main() function
if __name__ == "__main__":
  main()
