"""simple docstring"""







import re
import string

import numpy as np

import datasets


_a					:					Tuple=			"""
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					:					Optional[int]=			"""
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					:					Tuple=			"""
"""

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



				def  _lowercase					(self    :				List[Any])   ->     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  _lowercase					(self    :				List[str]     ,  _A    :				int     ,  _A    :				Any     ,  _A    :				List[Any]=None     ,  _A    :				Union[str, Any]=False     ,  _A    :				str=False     ,  _A    :				Tuple=False     ,  )   ->     str:

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

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

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

					if ignore_numbers:
						__snake_case      :							str						=			string.digits.maketrans(''     ,  ''     ,  string.digits)
						__snake_case      :							Dict						=			np.char.translate(__SCREAMING_SNAKE_CASE     ,  table=__SCREAMING_SNAKE_CASE)
						__snake_case      :							int						=			np.char.translate(__SCREAMING_SNAKE_CASE     ,  table=__SCREAMING_SNAKE_CASE)

					__snake_case      :							Dict						=			predictions == references

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



"""simple docstring"""







import warnings

from ...utils import logging
from .image_processing_clip import CLIPImageProcessor


_a					:					Dict=			logging.get_logger(__name__)

class 		UpperCamelCase      (   lowercase						):



				def __init__(self    :				List[str]     ,  *_A    :				Dict     ,  **_A    :				Optional[Any])   ->     None:
					warnings.warn(
					    'The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'
					    ' use CLIPImageProcessor instead.'     ,  _A     ,  )
					super().__init__(*_A     ,  **_A)





