





from math import cos, sin, sqrt, tau

from audio_filters.iir_filter import IIRFilter

def     a_       (					lowerCAmelCase_ :     int,      lowerCAmelCase_ :     int,      lowerCAmelCase_ :     float = 1 / sqrt(2      )      ):
   __lowerCAmelCase				      =      tau * frequency / samplerate
   __lowerCAmelCase				      =      sin(lowerCAmelCase_      )
   __lowerCAmelCase				      =      cos(lowerCAmelCase_      )
   __lowerCAmelCase				      =      _sin / (2 * q_factor)

   __lowerCAmelCase				      =      (1 - _cos) / 2
   __lowerCAmelCase				      =      1 - _cos

   __lowerCAmelCase				      =      1 + alpha
   __lowerCAmelCase				      =      -2 * _cos
   __lowerCAmelCase				      =      1 - alpha

   __lowerCAmelCase				      =      IIRFilter(2      )
   filt.set_coefficients([aa, aa, aa],      [ba, ba, ba]      )
   return filt

def     a_       (					lowerCAmelCase_ :     int,      lowerCAmelCase_ :     int,      lowerCAmelCase_ :     float = 1 / sqrt(2      )      ):
   __lowerCAmelCase				      =      tau * frequency / samplerate
   __lowerCAmelCase				      =      sin(lowerCAmelCase_      )
   __lowerCAmelCase				      =      cos(lowerCAmelCase_      )
   __lowerCAmelCase				      =      _sin / (2 * q_factor)

   __lowerCAmelCase				      =      (1 + _cos) / 2
   __lowerCAmelCase				      =      -1 - _cos

   __lowerCAmelCase				      =      1 + alpha
   __lowerCAmelCase				      =      -2 * _cos
   __lowerCAmelCase				      =      1 - alpha

   __lowerCAmelCase				      =      IIRFilter(2      )
   filt.set_coefficients([aa, aa, aa],      [ba, ba, ba]      )
   return filt

def     a_       (					lowerCAmelCase_ :     int,      lowerCAmelCase_ :     int,      lowerCAmelCase_ :     float = 1 / sqrt(2      )      ):
   __lowerCAmelCase				      =      tau * frequency / samplerate
   __lowerCAmelCase				      =      sin(lowerCAmelCase_      )
   __lowerCAmelCase				      =      cos(lowerCAmelCase_      )
   __lowerCAmelCase				      =      _sin / (2 * q_factor)

   __lowerCAmelCase				      =      _sin / 2
   __lowerCAmelCase				      =      0
   __lowerCAmelCase				      =      -ba

   __lowerCAmelCase				      =      1 + alpha
   __lowerCAmelCase				      =      -2 * _cos
   __lowerCAmelCase				      =      1 - alpha

   __lowerCAmelCase				      =      IIRFilter(2      )
   filt.set_coefficients([aa, aa, aa],      [ba, ba, ba]      )
   return filt

def     a_       (					lowerCAmelCase_ :     int,      lowerCAmelCase_ :     int,      lowerCAmelCase_ :     float = 1 / sqrt(2      )      ):
   __lowerCAmelCase				      =      tau * frequency / samplerate
   __lowerCAmelCase				      =      sin(lowerCAmelCase_      )
   __lowerCAmelCase				      =      cos(lowerCAmelCase_      )
   __lowerCAmelCase				      =      _sin / (2 * q_factor)

   __lowerCAmelCase				      =      1 - alpha
   __lowerCAmelCase				      =      -2 * _cos
   __lowerCAmelCase				      =      1 + alpha

   __lowerCAmelCase				      =      IIRFilter(2      )
   filt.set_coefficients([ba, ba, ba],      [ba, ba, ba]      )
   return filt

def     a_       (					lowerCAmelCase_ :     int,      lowerCAmelCase_ :     int,      lowerCAmelCase_ :     float,      lowerCAmelCase_ :     float = 1 / sqrt(2      ),      ):
   __lowerCAmelCase				      =      tau * frequency / samplerate
   __lowerCAmelCase				      =      sin(lowerCAmelCase_      )
   __lowerCAmelCase				      =      cos(lowerCAmelCase_      )
   __lowerCAmelCase				      =      _sin / (2 * q_factor)
   __lowerCAmelCase				      =      10 ** (gain_db / 40)

   __lowerCAmelCase				      =      1 + alpha * big_a
   __lowerCAmelCase				      =      -2 * _cos
   __lowerCAmelCase				      =      1 - alpha * big_a
   __lowerCAmelCase				      =      1 + alpha / big_a
   __lowerCAmelCase				      =      -2 * _cos
   __lowerCAmelCase				      =      1 - alpha / big_a

   __lowerCAmelCase				      =      IIRFilter(2      )
   filt.set_coefficients([aa, aa, aa],      [ba, ba, ba]      )
   return filt

def     a_       (					lowerCAmelCase_ :     int,      lowerCAmelCase_ :     int,      lowerCAmelCase_ :     float,      lowerCAmelCase_ :     float = 1 / sqrt(2      ),      ):
   __lowerCAmelCase				      =      tau * frequency / samplerate
   __lowerCAmelCase				      =      sin(lowerCAmelCase_      )
   __lowerCAmelCase				      =      cos(lowerCAmelCase_      )
   __lowerCAmelCase				      =      _sin / (2 * q_factor)
   __lowerCAmelCase				      =      10 ** (gain_db / 40)
   __lowerCAmelCase				      =      (big_a + 1) - (big_a - 1) * _cos
   __lowerCAmelCase				      =      (big_a + 1) + (big_a - 1) * _cos
   __lowerCAmelCase				      =      (big_a - 1) - (big_a + 1) * _cos
   __lowerCAmelCase				      =      (big_a - 1) + (big_a + 1) * _cos
   __lowerCAmelCase				      =      2 * sqrt(lowerCAmelCase_      ) * alpha

   __lowerCAmelCase				      =      big_a * (pmc + aaa)
   __lowerCAmelCase				      =      2 * big_a * mpc
   __lowerCAmelCase				      =      big_a * (pmc - aaa)
   __lowerCAmelCase				      =      ppmc + aaa
   __lowerCAmelCase				      =      -2 * pmpc
   __lowerCAmelCase				      =      ppmc - aaa

   __lowerCAmelCase				      =      IIRFilter(2      )
   filt.set_coefficients([aa, aa, aa],      [ba, ba, ba]      )
   return filt




def     a_       (					lowerCAmelCase_ :     int,      lowerCAmelCase_ :     int,      lowerCAmelCase_ :     float,      lowerCAmelCase_ :     float = 1 / sqrt(2      ),      ):
   __lowerCAmelCase				      =      tau * frequency / samplerate
   __lowerCAmelCase				      =      sin(lowerCAmelCase_      )
   __lowerCAmelCase				      =      cos(lowerCAmelCase_      )
   __lowerCAmelCase				      =      _sin / (2 * q_factor)
   __lowerCAmelCase				      =      10 ** (gain_db / 40)
   __lowerCAmelCase				      =      (big_a + 1) - (big_a - 1) * _cos
   __lowerCAmelCase				      =      (big_a + 1) + (big_a - 1) * _cos
   __lowerCAmelCase				      =      (big_a - 1) - (big_a + 1) * _cos
   __lowerCAmelCase				      =      (big_a - 1) + (big_a + 1) * _cos
   __lowerCAmelCase				      =      2 * sqrt(lowerCAmelCase_      ) * alpha

   __lowerCAmelCase				      =      big_a * (ppmc + aaa)
   __lowerCAmelCase				      =      -2 * big_a * pmpc
   __lowerCAmelCase				      =      big_a * (ppmc - aaa)
   __lowerCAmelCase				      =      pmc + aaa
   __lowerCAmelCase				      =      2 * mpc
   __lowerCAmelCase				      =      pmc - aaa

   __lowerCAmelCase				      =      IIRFilter(2      )
   filt.set_coefficients([aa, aa, aa],      [ba, ba, ba]      )
   return filt



import datasets


A		: Optional[int]								=     '''\
@InProceedings{conneau2018xnli,
  author = "Conneau, Alexis
                 and Rinott, Ruty
                 and Lample, Guillaume
                 and Williams, Adina
                 and Bowman, Samuel R.
                 and Schwenk, Holger
                 and Stoyanov, Veselin",
  title = "XNLI: Evaluating Cross-lingual Sentence Representations",
  booktitle = "Proceedings of the 2018 Conference on Empirical Methods
               in Natural Language Processing",
  year = "2018",
  publisher = "Association for Computational Linguistics",
  location = "Brussels, Belgium",
}
'''

A		: Optional[int]								=     '''\
XNLI is a subset of a few thousand examples from MNLI which has been translated
into a 14 different languages (some low-ish resource). As with MNLI, the goal is
to predict textual entailment (does sentence A imply/contradict/neither sentence
B) and is a classification task (given two sentences, predict one of three
labels).
'''

A		: str								=     '''
Computes XNLI score which is just simple accuracy.
Args:
    predictions: Predicted labels.
    references: Ground truth labels.
Returns:
    \'accuracy\': accuracy
Examples:

    >>> predictions = [0, 1]
    >>> references = [0, 1]
    >>> xnli_metric = datasets.load_metric("xnli")
    >>> results = xnli_metric.compute(predictions=predictions, references=references)
    >>> print(results)
    {\'accuracy\': 1.0}
'''




def 	UpperCamelCase__  (     SCREAMING_SNAKE_CASE_	:	List[str]		,   SCREAMING_SNAKE_CASE_	:	List[Any]       )  ->     str:
						return (preds == labels).mean()



@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION					,			_KWARGS_DESCRIPTION    )
class    a_ (			datasets.Metric    ):






			def    UpperCamelCase_				(      self  ):
									return datasets.MetricInfo(
									    description=_DESCRIPTION				,			citation=_CITATION				,			inputs_description=_KWARGS_DESCRIPTION				,			features=datasets.Features(
									        {
									            """predictions""": datasets.Value("""int64""" if self.config_name != """sts-b""" else """float32"""  ),
									            """references""": datasets.Value("""int64""" if self.config_name != """sts-b""" else """float32"""  ),
									        }  )				,			codebase_urls=[]				,			reference_urls=[]				,			format="""numpy"""				,			)






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase  ):
									return {"accuracy": simple_accuracy(__UpperCamelCase				,			__UpperCamelCase  )}