
"""simple docstring"""
import re
import string

import numpy as np

import datasets


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

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

"""

lowerCamelCase_       =		"""
"""






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




       def    _UpperCamelCase					(						self							)      ->				Union[str, Any]:





             """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    _UpperCamelCase					(						self		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__=None		,SCREAMING_SNAKE_CASE__=False		,SCREAMING_SNAKE_CASE__=False		,SCREAMING_SNAKE_CASE__=False		,)      ->				Tuple:





             """simple docstring"""






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

             if ignore_case:
                   __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  np.char.lower(SCREAMING_SNAKE_CASE__							)
                   __SCREAMING_SNAKE_CASE       :List[Any]		    =  np.char.lower(SCREAMING_SNAKE_CASE__							)

             if ignore_punctuation:
                   __SCREAMING_SNAKE_CASE       :Optional[int]		    =  string.punctuation.maketrans(''''''		,''''''		,string.punctuation							)
                   __SCREAMING_SNAKE_CASE       :List[Any]		    =  np.char.translate(SCREAMING_SNAKE_CASE__		,table=SCREAMING_SNAKE_CASE__							)
                   __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  np.char.translate(SCREAMING_SNAKE_CASE__		,table=SCREAMING_SNAKE_CASE__							)

             if ignore_numbers:
                   __SCREAMING_SNAKE_CASE       :Any		    =  string.digits.maketrans(''''''		,''''''		,string.digits							)
                   __SCREAMING_SNAKE_CASE       :Tuple		    =  np.char.translate(SCREAMING_SNAKE_CASE__		,table=SCREAMING_SNAKE_CASE__							)
                   __SCREAMING_SNAKE_CASE       :Dict		    =  np.char.translate(SCREAMING_SNAKE_CASE__		,table=SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  predictions == references

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






"""simple docstring"""
def 					__lowerCamelCase       (							a_					:		int			,       a_					:		int							)      ->				int:
      return int((input_a, input_a).count(0							) == 0							)



def 					__lowerCamelCase       (							)      ->				None:
      assert and_gate(0			,       0							) == 0
      assert and_gate(0			,       1							) == 0
      assert and_gate(1			,       0							) == 0
      assert and_gate(1			,       1							) == 1


if __name__ == "__main__":
  test_and_gate()
  print(and_gate(1, 0))
  print(and_gate(0, 0))
  print(and_gate(0, 1))
  print(and_gate(1, 1))