




"""simple docstring"""

import re
import string

import numpy as np

import datasets


a							      =     '''
Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.
'''

a							      =     '''
Args:
    predictions: List of predicted texts.
    references: List of reference texts.
    regexes_to_ignore: List, defaults to None. Regex expressions of characters to
        ignore when calculating the exact matches. Note: these regexes are removed
        from the input data before the changes based on the options below (e.g. ignore_case,
        ignore_punctuation, ignore_numbers) are applied.
    ignore_case: Boolean, defaults to False. If true, turns everything
        to lowercase so that capitalization differences are ignored.
    ignore_punctuation: Boolean, defaults to False. If true, removes all punctuation before
        comparing predictions and references.
    ignore_numbers: Boolean, defaults to False. If true, removes all punctuation before
        comparing predictions and references.
Returns:
    exact_match: Dictionary containing exact_match rate. Possible values are between 0.0 and 100.0, inclusive.
Examples:
    >>> exact_match = datasets.load_metric("exact_match")
    >>> refs = ["the cat", "theater", "YELLING", "agent007"]
    >>> preds = ["cat?", "theater", "yelling", "agent"]
    >>> results = exact_match.compute(references=refs, predictions=preds)
    >>> print(round(results["exact_match"], 1))
    25.0

    >>> exact_match = datasets.load_metric("exact_match")
    >>> refs = ["the cat", "theater", "YELLING", "agent007"]
    >>> preds = ["cat?", "theater", "yelling", "agent"]
    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=["the ", "yell"], ignore_case=True, ignore_punctuation=True)
    >>> print(round(results["exact_match"], 1))
    50.0


    >>> exact_match = datasets.load_metric("exact_match")
    >>> refs = ["the cat", "theater", "YELLING", "agent007"]
    >>> preds = ["cat?", "theater", "yelling", "agent"]
    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=["the ", "yell", "YELL"], ignore_case=True, ignore_punctuation=True)
    >>> print(round(results["exact_match"], 1))
    75.0

    >>> exact_match = datasets.load_metric("exact_match")
    >>> refs = ["the cat", "theater", "YELLING", "agent007"]
    >>> preds = ["cat?", "theater", "yelling", "agent"]
    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=["the ", "yell", "YELL"], ignore_case=True, ignore_punctuation=True, ignore_numbers=True)
    >>> print(round(results["exact_match"], 1))
    100.0

    >>> exact_match = datasets.load_metric("exact_match")
    >>> refs = ["The cat sat on the mat.", "Theaters are great.", "It\'s like comparing oranges and apples."]
    >>> preds = ["The cat sat on the mat?", "Theaters are great.", "It\'s like comparing apples and oranges."]
    >>> results = exact_match.compute(references=refs, predictions=preds)
    >>> print(round(results["exact_match"], 1))
    33.3

'''

a							      =     '''
'''





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



 '''simple docstring'''

 def      lowerCAmelCase_				(					self			:			Optional[Any]						):
       return datasets.MetricInfo(
           description=_DESCRIPTION       ,				citation=_CITATION       ,				inputs_description=_KWARGS_DESCRIPTION       ,				features=datasets.Features(
               {
                   'predictions': datasets.Value('string'       ,				id='sequence'						),
                   'references': datasets.Value('string'       ,				id='sequence'						),
               }						)       ,				reference_urls=[]       ,				)



 def      lowerCAmelCase_				(					self			:			str       ,				_UpperCAmelCase			:			Any       ,				_UpperCAmelCase			:			Dict       ,				_UpperCAmelCase			:			Any=None       ,				_UpperCAmelCase			:			Dict=False       ,				_UpperCAmelCase			:			Optional[Any]=False       ,				_UpperCAmelCase			:			Optional[Any]=False       ,				):
       if regexes_to_ignore is not None:
             for s in regexes_to_ignore:
                   _A     =  np.array([re.sub(_UpperCAmelCase       ,				''       ,				_UpperCAmelCase						) for x in predictions]						)
                   _A     =  np.array([re.sub(_UpperCAmelCase       ,				''       ,				_UpperCAmelCase						) for x in references]						)
       else:
             _A     =  np.asarray(_UpperCAmelCase						)
             _A     =  np.asarray(_UpperCAmelCase						)

       if ignore_case:
             _A     =  np.char.lower(_UpperCAmelCase						)
             _A     =  np.char.lower(_UpperCAmelCase						)

       if ignore_punctuation:
             _A     =  string.punctuation.maketrans(''       ,				''       ,				string.punctuation						)
             _A     =  np.char.translate(_UpperCAmelCase       ,				table=_UpperCAmelCase						)
             _A     =  np.char.translate(_UpperCAmelCase       ,				table=_UpperCAmelCase						)

       if ignore_numbers:
             _A     =  string.digits.maketrans(''       ,				''       ,				string.digits						)
             _A     =  np.char.translate(_UpperCAmelCase       ,				table=_UpperCAmelCase						)
             _A     =  np.char.translate(_UpperCAmelCase       ,				table=_UpperCAmelCase						)

       _A     =  predictions == references

       return {"exact_match": np.mean(_UpperCAmelCase						) * 100}





"""simple docstring"""
from __future__ import annotations

from numpy import array, cos, cross, floataa, radians, sin
from numpy.typing import NDArray

def 				_snake_case      (   __snake_case							:      float						, __snake_case							:      float						, __snake_case							:      bool = False   ):




   """simple docstring"""







   if radian_mode:
      return [magnitude * cos(__snake_case   ), magnitude * sin(__snake_case   )]
   return [magnitude * cos(radians(__snake_case   )   ), magnitude * sin(radians(__snake_case   )   )]

def 				_snake_case      (   __snake_case							:      NDArray[floataa]						, __snake_case							:      NDArray[floataa]						, __snake_case							:      float = 10**-1   ):




   """simple docstring"""







   _lowerCamelCase	:					NDArray[floataa]   =		cross(__snake_case						, __snake_case   )
   _lowerCamelCase	:					float   =		sum(__snake_case   )
   return abs(__snake_case   ) < eps


if __name__ == "__main__":
 # Test to check if it works
 UpperCAmelCase				=						array(
     [
         polar_force(718.4, 180 - 30),
         polar_force(879.54, 45),
         polar_force(100, -90),
     ]
 )

 UpperCAmelCase				=						array([[0, 0], [0, 0], [0, 0]])

 assert in_static_equilibrium(forces, location)

 # Problem 1 in image_data/2D_problems.jpg
 UpperCAmelCase				=						array(
     [
         polar_force(30 * 9.81, 15),
         polar_force(215, 180 - 45),
         polar_force(264, 90 - 30),
     ]
 )

 UpperCAmelCase				=						array([[0, 0], [0, 0], [0, 0]])

 assert in_static_equilibrium(forces, location)

 # Problem in image_data/2D_problems_1.jpg
 UpperCAmelCase				=						array([[0, -2000], [0, -1200], [0, 1_5600], [0, -1_2400]])

 UpperCAmelCase				=						array([[0, 0], [6, 0], [10, 0], [12, 0]])

 assert in_static_equilibrium(forces, location)

 import doctest

 doctest.testmod()

