from typing import List, Optional, Union

import numpy as np

from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function
from ....feature_extraction_sequence_utils import SequenceFeatureExtractor
from ....feature_extraction_utils import BatchFeature
from ....file_utils import PaddingStrategy, TensorType
from ....utils import logging


lowerCamelCase__    :		List[Any]          =   logging.get_logger(__name__)



class       _snake_case   (	UpperCAmelCase_							):
 __lowerCAmelCase  :     Dict        =			['input_features', 'attention_mask']


 def __init__(					self					,  SCREAMING_SNAKE_CASE_=80					,  SCREAMING_SNAKE_CASE_=1_60_00					,  SCREAMING_SNAKE_CASE_=0.0					,  SCREAMING_SNAKE_CASE_=10					,  SCREAMING_SNAKE_CASE_=25					,  SCREAMING_SNAKE_CASE_="hamming_window"					,  SCREAMING_SNAKE_CASE_=3_27_68.0					,  SCREAMING_SNAKE_CASE_=0.9_7					,  SCREAMING_SNAKE_CASE_=1.0					,  SCREAMING_SNAKE_CASE_=True					,  SCREAMING_SNAKE_CASE_=True					,  SCREAMING_SNAKE_CASE_=False					,  **SCREAMING_SNAKE_CASE_					,  ):


   '''simple docstring'''




   super().__init__(feature_size=SCREAMING_SNAKE_CASE_					,  sampling_rate=SCREAMING_SNAKE_CASE_					,  padding_value=SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_)

   lowercase__  :   str    		=      feature_size
   lowercase__  :   Dict    		=      sampling_rate
   lowercase__  :   List[Any]    		=      padding_value
   lowercase__  :   Dict    		=      hop_length
   lowercase__  :   List[Any]    		=      win_length
   lowercase__  :   Any    		=      frame_signal_scale
   lowercase__  :   Dict    		=      preemphasis_coeff
   lowercase__  :   str    		=      mel_floor
   lowercase__  :   Union[str, Any]    		=      normalize_means
   lowercase__  :   Optional[int]    		=      normalize_vars
   lowercase__  :   Optional[int]    		=      win_function
   lowercase__  :   Optional[Any]    		=      return_attention_mask

   lowercase__  :   List[Any]    		=      win_length * sampling_rate // 10_00
   lowercase__  :   int    		=      hop_length * sampling_rate // 10_00

   lowercase__  :   Tuple    		=      optimal_fft_length(self.sample_size)
   lowercase__  :   Any    		=      (self.n_fft // 2) + 1


 def      lowercase__     (					self					,  SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   if self.win_function == "hamming_window":
     lowercase__  :   int    		=      window_function(window_length=self.sample_size					,  name=self.win_function					,  periodic=SCREAMING_SNAKE_CASE_)
   else:
     lowercase__  :   Dict    		=      window_function(window_length=self.sample_size					,  name=self.win_function)

   lowercase__  :   List[str]    		=      mel_filter_bank(
       num_frequency_bins=self.n_freqs					,  num_mel_filters=self.feature_size					,  min_frequency=0.0					,  max_frequency=self.sampling_rate / 2.0					,  sampling_rate=self.sampling_rate					,  )

   lowercase__  :   Optional[int]    		=      spectrogram(
       one_waveform * self.frame_signal_scale					,  window=SCREAMING_SNAKE_CASE_					,  frame_length=self.sample_size					,  hop_length=self.sample_stride					,  fft_length=self.n_fft					,  center=SCREAMING_SNAKE_CASE_					,  preemphasis=self.preemphasis_coeff					,  mel_filters=SCREAMING_SNAKE_CASE_					,  mel_floor=self.mel_floor					,  log_mel="""log"""					,  )
   return msfc_features.T


 def      lowercase__     (					self					,  SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   if self.normalize_means:
     lowercase__  :   List[Any]    		=      x[:input_length].mean(axis=0)
     lowercase__  :   List[str]    		=      np.subtract(SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_)
   if self.normalize_vars:
     lowercase__  :   str    		=      x[:input_length].std(axis=0)
     lowercase__  :   List[str]    		=      np.divide(SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_)

   if input_length < x.shape[0]:
     lowercase__  :   Optional[int]    		=      padding_value

   # make sure array is in float32
   lowercase__  :   List[str]    		=      x.astype(np.floataa)

   return x


 def      lowercase__     (					self					,  SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_ = None):


   '''simple docstring'''




   lowercase__  :   Optional[Any]    		=      attention_mask.sum(-1) if attention_mask is not None else [x.shape[0] for x in input_features]
   return [self._normalize_one(SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_					,  self.padding_value) for x, n in zip(SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_)]



 def __call__(					self					,  SCREAMING_SNAKE_CASE_					,  SCREAMING_SNAKE_CASE_ = False					,  SCREAMING_SNAKE_CASE_ = None					,  SCREAMING_SNAKE_CASE_ = False					,  SCREAMING_SNAKE_CASE_ = None					,  SCREAMING_SNAKE_CASE_ = None					,  SCREAMING_SNAKE_CASE_ = None					,  SCREAMING_SNAKE_CASE_ = None					,  **SCREAMING_SNAKE_CASE_					,  ):


   '''simple docstring'''




   if sampling_rate is not None:
     if sampling_rate != self.sampling_rate:
       raise ValueError(
           f'The model corresponding to this feature extractor: {self} was trained using a sampling rate of'
           f' {self.sampling_rate}. Please make sure that the provided `raw_speech` input was sampled with'
           f' {self.sampling_rate} and not {sampling_rate}.')
   else:
     logger.warning(
         """It is strongly recommended to pass the ``sampling_rate`` argument to this function. """
         """Failing to do so can result in silent errors that might be hard to debug.""")

   lowercase__  :   Optional[int]    		=      isinstance(SCREAMING_SNAKE_CASE_					,  np.ndarray) and len(raw_speech.shape) > 1
   if is_batched_numpy and len(raw_speech.shape) > 2:
     raise ValueError(f'Only mono-channel audio is supported for input to {self}')
   lowercase__  :   Any    		=      is_batched_numpy or (
       isinstance(SCREAMING_SNAKE_CASE_					,  (list, tuple)) and (isinstance(raw_speech[0]					,  (np.ndarray, tuple, list)))
   )

   if is_batched:
     lowercase__  :   str    		=      [np.asarray(SCREAMING_SNAKE_CASE_					,  dtype=np.floataa) for speech in raw_speech]
   elif not is_batched and not isinstance(SCREAMING_SNAKE_CASE_					,  np.ndarray):
     lowercase__  :   Any    		=      np.asarray(SCREAMING_SNAKE_CASE_					,  dtype=np.floataa)
   elif isinstance(SCREAMING_SNAKE_CASE_					,  np.ndarray) and raw_speech.dtype is np.dtype(np.floataa):
     lowercase__  :   str    		=      raw_speech.astype(np.floataa)

   # always return batch
   if not is_batched:
     lowercase__  :   Any    		=      [raw_speech]

   # extract fbank features
   lowercase__  :   Union[str, Any]    		=      [self._extract_mfsc_features(SCREAMING_SNAKE_CASE_) for one_waveform in raw_speech]

   # convert into correct format for padding
   lowercase__  :   Optional[Any]    		=      BatchFeature({"""input_features""": features})

   lowercase__  :   Any    		=      self.pad(
       SCREAMING_SNAKE_CASE_					,  padding=SCREAMING_SNAKE_CASE_					,  max_length=SCREAMING_SNAKE_CASE_					,  truncation=SCREAMING_SNAKE_CASE_					,  pad_to_multiple_of=SCREAMING_SNAKE_CASE_					,  return_attention_mask=SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_					,  )
   # make sure list is in array format
   lowercase__  :   Optional[Any]    		=      padded_inputs.get("""input_features""")
   if isinstance(input_features[0]					,  SCREAMING_SNAKE_CASE_):
     lowercase__  :   List[str]    		=      [np.asarray(SCREAMING_SNAKE_CASE_					,  dtype=np.floataa) for feature in input_features]

   lowercase__  :   Union[str, Any]    		=      padded_inputs.get("""attention_mask""")
   if attention_mask is not None:
     lowercase__  :   Optional[Any]    		=      [np.asarray(SCREAMING_SNAKE_CASE_					,  dtype=np.intaa) for array in attention_mask]

   if self.normalize_means or self.normalize_vars:
     lowercase__  :   Dict    		=      (
         np.array(SCREAMING_SNAKE_CASE_					,  dtype=np.intaa)
         if self._get_padding_strategies(SCREAMING_SNAKE_CASE_					,  max_length=SCREAMING_SNAKE_CASE_) is not PaddingStrategy.DO_NOT_PAD
         and padding
         else None
     )
     lowercase__  :   Tuple    		=      self.normalize(
         padded_inputs["""input_features"""]					,  attention_mask=SCREAMING_SNAKE_CASE_)

   if return_tensors is not None:
     lowercase__  :   Any    		=      padded_inputs.convert_to_tensors(SCREAMING_SNAKE_CASE_)

   return padded_inputs








import sys

lowerCamelCase__    :		List[Any]          =   (
    """73167176531330624919225119674426574742355349194934"""
    """96983520312774506326239578318016984801869478851843"""
    """85861560789112949495459501737958331952853208805511"""
    """12540698747158523863050715693290963295227443043557"""
    """66896648950445244523161731856403098711121722383113"""
    """62229893423380308135336276614282806444486645238749"""
    """30358907296290491560440772390713810515859307960866"""
    """70172427121883998797908792274921901699720888093776"""
    """65727333001053367881220235421809751254540594752243"""
    """52584907711670556013604839586446706324415722155397"""
    """53697817977846174064955149290862569321978468622482"""
    """83972241375657056057490261407972968652414535100474"""
    """82166370484403199890008895243450658541227588666881"""
    """16427171479924442928230863465674813919123162824586"""
    """17866458359124566529476545682848912883142607690042"""
    """24219022671055626321111109370544217506941658960408"""
    """07198403850962455444362981230987879927244284909188"""
    """84580156166097919133875499200524063689912560717606"""
    """05886116467109405077541002256983155200055935729725"""
    """71636269561882670428252483600823257530420752963450"""
)

def 		UpperCamelCase	(      lowercase_ = N   )		->	int:


  '''simple docstring'''






  lowercase__  :   int    		=      -sys.maxsize - 1
  for i in range(len(lowercase_   ) - 12   ):
    lowercase__  :   Optional[int]    		=      1
    for j in range(13   ):
      product *= int(n[i + j]   )
    if product > largest_product:
      lowercase__  :   int    		=      product
  return largest_product


if __name__ == "__main__":
     print(f'''{solution() = }''')






