


import re
import string

import numpy as np

import datasets


UpperCAmelCase    =					"""
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.
"""

UpperCAmelCase    =					"""
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

"""

UpperCAmelCase    =					"""
"""







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

 '''simple docstring'''

 def 		UpperCamelCase__  (			self      ):
       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 		UpperCamelCase__  (			self	,   _UpperCAmelCase	,   _UpperCAmelCase	,   _UpperCAmelCase=None	,   _UpperCAmelCase=False	,   _UpperCAmelCase=False	,   _UpperCAmelCase=False	,   ):
       if regexes_to_ignore is not None:
             for s in regexes_to_ignore:
                   snake_case_ =   np.array([re.sub(_UpperCAmelCase	,   ''''''	,   _UpperCAmelCase      ) for x in predictions]      )
                   snake_case_ =   np.array([re.sub(_UpperCAmelCase	,   ''''''	,   _UpperCAmelCase      ) for x in references]      )
       else:
             snake_case_ =   np.asarray(_UpperCAmelCase      )
             snake_case_ =   np.asarray(_UpperCAmelCase      )

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

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

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

       snake_case_ =   predictions == references

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



import requests






def  __lowerCAmelCase					(SCREAMING_SNAKE_CASE      ,      SCREAMING_SNAKE_CASE      )->						None:




      """simple docstring"""

      snake_case_ =   {'''Content-Type''': '''application/json'''}
      snake_case_ =   requests.post(SCREAMING_SNAKE_CASE      ,      json={'''text''': message_body}      ,      headers=SCREAMING_SNAKE_CASE      )
      if response.status_code != 200:
            snake_case_ =   (
                '''Request to slack returned an error '''
                f'''{response.status_code}, the response is:\n{response.text}'''
            )
            raise ValueError(SCREAMING_SNAKE_CASE      )


if __name__ == "__main__":
   # Set the slack url to the one provided by Slack when you create the webhook at
   # https://my.slack.com/services/new/incoming-webhook/
   send_slack_message("""<YOUR MESSAGE BODY>""", """<SLACK CHANNEL URL>""")