





import re
import string

import numpy as np

import datasets


lowercase      :       Optional[Any]									=  """
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.
"""

lowercase      :       List[str]									=  """
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

"""

lowercase      :       Optional[Any]									=  """
"""





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




   """simple docstring"""



   def 							__lowercase		(					self)			->						Tuple:







          '''simple docstring'''

          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 							__lowercase		(					self					,  lowercase					,  lowercase					,  lowercase=None					,  lowercase=False					,  lowercase=False					,  lowercase=False					,  )			->						Tuple:







          '''simple docstring'''

          if regexes_to_ignore is not None:
                 for s in regexes_to_ignore:
                        a__						:	Optional[int] =				np.array([re.sub(lowercase					,  ''					,  lowercase) for x in predictions])
                        a__						:	Tuple =				np.array([re.sub(lowercase					,  ''					,  lowercase) for x in references])
          else:
                 a__						:	Dict =				np.asarray(lowercase)
                 a__						:	List[Any] =				np.asarray(lowercase)

          if ignore_case:
                 a__						:	Optional[Any] =				np.char.lower(lowercase)
                 a__						:	Dict =				np.char.lower(lowercase)

          if ignore_punctuation:
                 a__						:	int =				string.punctuation.maketrans(''					,  ''					,  string.punctuation)
                 a__						:	Tuple =				np.char.translate(lowercase					,  table=lowercase)
                 a__						:	List[str] =				np.char.translate(lowercase					,  table=lowercase)

          if ignore_numbers:
                 a__						:	List[Any] =				string.digits.maketrans(''					,  ''					,  string.digits)
                 a__						:	Dict =				np.char.translate(lowercase					,  table=lowercase)
                 a__						:	Tuple =				np.char.translate(lowercase					,  table=lowercase)

          a__						:	int =				predictions == references

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



"""simple docstring"""






__A			   = [
    (1_0_0_0, "M"),
    (9_0_0, "CM"),
    (5_0_0, "D"),
    (4_0_0, "CD"),
    (1_0_0, "C"),
    (9_0, "XC"),
    (5_0, "L"),
    (4_0, "XL"),
    (1_0, "X"),
    (9, "IX"),
    (5, "V"),
    (4, "IV"),
    (1, "I"),
]



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase )  ->  int:
   lowercase__:   Dict					=      {'''I''': 1, '''V''': 5, '''X''': 1_0, '''L''': 5_0, '''C''': 1_0_0, '''D''': 5_0_0, '''M''': 1_0_0_0}
   lowercase__:   List[str]					=      0
   lowercase__:   List[Any]					=      0
   while place < len(__UpperCAmelCase ):
      if (place + 1 < len(__UpperCAmelCase )) and (vals[roman[place]] < vals[roman[place + 1]]):
         total += vals[roman[place + 1]] - vals[roman[place]]
         place += 2
      else:
         total += vals[roman[place]]
         place += 1
   return total



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase )  ->  str:
   lowercase__:   Optional[Any]					=      []
   for arabic, roman in ROMAN:
      ((lowercase__), (lowercase__)):   Tuple					=      divmod(__UpperCAmelCase       ,    __UpperCAmelCase )
      result.append(roman * factor )
      if number == 0:
         break
   return "".join(__UpperCAmelCase )


if __name__ == "__main__":
       import doctest

       doctest.testmod()
