




"""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'''



# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


A__						:   Any				=    re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""")





@total_ordering
@dataclass
class   UpperCAmelCase_    :





    """simple docstring"""






    lowerCamelCase    :   str
    lowerCamelCase    :   Optional[str]					=     None
    lowerCamelCase    :   Optional[Union[str, int]]					=     None
    lowerCamelCase    :   Optional[Union[str, int]]					=     None
    lowerCamelCase    :   Optional[Union[str, int]]					=     None







    def  lowercase_							(				self      )							->	List[str]:
         __lowerCamelCase							,			__lowerCamelCase							,			__lowerCamelCase  :      List[Any]														=						_str_to_version_tuple(self.version_str      )







    def __repr__(				self      )							->	Any:
         return f'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'







    @property
    def  lowercase_							(				self      )							->	int:
         return self.major, self.minor, self.patch







    def  lowercase_							(				self     ,	SCREAMING_SNAKE_CASE_      )							->	List[Any]:
         if isinstance(SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_      ):
              return Version(SCREAMING_SNAKE_CASE_      )
         elif isinstance(SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_      ):
              return other
         raise TypeError(f'{other} (type {type(SCREAMING_SNAKE_CASE_      )}) cannot be compared to version.'      )







    def __eq__(				self     ,	SCREAMING_SNAKE_CASE_      )							->	Optional[Any]:
         try:
              __lowerCamelCase  :      Union[str, Any]														=						self._validate_operand(SCREAMING_SNAKE_CASE_      )
         except (TypeError, ValueError):
              return False
         else:
              return self.tuple == other.tuple







    def __lt__(				self     ,	SCREAMING_SNAKE_CASE_      )							->	List[Any]:
         __lowerCamelCase  :      List[Any]														=						self._validate_operand(SCREAMING_SNAKE_CASE_      )
         return self.tuple < other.tuple







    def __hash__(				self      )							->	List[str]:
         return hash(_version_tuple_to_str(self.tuple      )      )







    @classmethod
    def  lowercase_							(				cls     ,	SCREAMING_SNAKE_CASE_      )							->	List[str]:
         __lowerCamelCase  :      str														=						{f.name for f in dataclasses.fields(cls      )}
         return cls(**{k: v for k, v in dic.items() if k in field_names}      )







    def  lowercase_							(				self      )							->	str:
         return self.version_str







def      UpperCAmelCase__   (      UpperCAmelCase_       :							Union[str, Any]				)	->						str:
     __lowerCamelCase  :      str														=						_VERSION_REG.match(UpperCAmelCase_				)
     if not res:
          raise ValueError(F'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'				)
     return tuple(int(UpperCAmelCase_				) for v in [res.group('major'				), res.group('minor'				), res.group('patch'				)]				)



def      UpperCAmelCase__   (      UpperCAmelCase_       :							List[str]				)	->						Dict:
     return ".".join(str(UpperCAmelCase_				) for v in version_tuple				)






