



import re
import string

import numpy as np

import datasets


_snake_case						=    "\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n"

_snake_case						=    "\nArgs:\n    predictions: List of predicted texts.\n    references: List of reference texts.\n    regexes_to_ignore: List, defaults to None. Regex expressions of characters to\n        ignore when calculating the exact matches. Note: these regexes are removed\n        from the input data before the changes based on the options below (e.g. ignore_case,\n        ignore_punctuation, ignore_numbers) are applied.\n    ignore_case: Boolean, defaults to False. If true, turns everything\n        to lowercase so that capitalization differences are ignored.\n    ignore_punctuation: Boolean, defaults to False. If true, removes all punctuation before\n        comparing predictions and references.\n    ignore_numbers: Boolean, defaults to False. If true, removes all punctuation before\n        comparing predictions and references.\nReturns:\n    exact_match: Dictionary containing exact_match rate. Possible values are between 0.0 and 100.0, inclusive.\nExamples:\n    >>> exact_match = datasets.load_metric(\"exact_match\")\n    >>> refs = [\"the cat\", \"theater\", \"YELLING\", \"agent007\"]\n    >>> preds = [\"cat?\", \"theater\", \"yelling\", \"agent\"]\n    >>> results = exact_match.compute(references=refs, predictions=preds)\n    >>> print(round(results[\"exact_match\"], 1))\n    25.0\n\n    >>> exact_match = datasets.load_metric(\"exact_match\")\n    >>> refs = [\"the cat\", \"theater\", \"YELLING\", \"agent007\"]\n    >>> preds = [\"cat?\", \"theater\", \"yelling\", \"agent\"]\n    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=[\"the \", \"yell\"], ignore_case=True, ignore_punctuation=True)\n    >>> print(round(results[\"exact_match\"], 1))\n    50.0\n\n\n    >>> exact_match = datasets.load_metric(\"exact_match\")\n    >>> refs = [\"the cat\", \"theater\", \"YELLING\", \"agent007\"]\n    >>> preds = [\"cat?\", \"theater\", \"yelling\", \"agent\"]\n    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=[\"the \", \"yell\", \"YELL\"], ignore_case=True, ignore_punctuation=True)\n    >>> print(round(results[\"exact_match\"], 1))\n    75.0\n\n    >>> exact_match = datasets.load_metric(\"exact_match\")\n    >>> refs = [\"the cat\", \"theater\", \"YELLING\", \"agent007\"]\n    >>> preds = [\"cat?\", \"theater\", \"yelling\", \"agent\"]\n    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=[\"the \", \"yell\", \"YELL\"], ignore_case=True, ignore_punctuation=True, ignore_numbers=True)\n    >>> print(round(results[\"exact_match\"], 1))\n    100.0\n\n    >>> exact_match = datasets.load_metric(\"exact_match\")\n    >>> refs = [\"The cat sat on the mat.\", \"Theaters are great.\", \"It\'s like comparing oranges and apples.\"]\n    >>> preds = [\"The cat sat on the mat?\", \"Theaters are great.\", \"It\'s like comparing apples and oranges.\"]\n    >>> results = exact_match.compute(references=refs, predictions=preds)\n    >>> print(round(results[\"exact_match\"], 1))\n    33.3\n\n"

_snake_case						=    "\n"



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







							def   snake_case__ (  self):

														'''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   snake_case__ (  self,     __a,     __a,     __a=None,     __a=False,     __a=False,     __a=False,     ):

														'''simple docstring'''

														if regexes_to_ignore is not None:
																					for s in regexes_to_ignore:
																												_lowerCAmelCase	:				Union[str, Any]					  =       np.array([re.sub(lowerCAmelCase_,     "",     lowerCAmelCase_) for x in predictions])
																												_lowerCAmelCase	:				Optional[int]					  =       np.array([re.sub(lowerCAmelCase_,     "",     lowerCAmelCase_) for x in references])
														else:
																					_lowerCAmelCase	:				Union[str, Any]					  =       np.asarray(lowerCAmelCase_)
																					_lowerCAmelCase	:				List[Any]					  =       np.asarray(lowerCAmelCase_)

														if ignore_case:
																					_lowerCAmelCase	:				List[Any]					  =       np.char.lower(lowerCAmelCase_)
																					_lowerCAmelCase	:				Optional[Any]					  =       np.char.lower(lowerCAmelCase_)

														if ignore_punctuation:
																					_lowerCAmelCase	:				Optional[int]					  =       string.punctuation.maketrans("",     "",     string.punctuation)
																					_lowerCAmelCase	:				Optional[int]					  =       np.char.translate(lowerCAmelCase_,     table=lowerCAmelCase_)
																					_lowerCAmelCase	:				Any					  =       np.char.translate(lowerCAmelCase_,     table=lowerCAmelCase_)

														if ignore_numbers:
																					_lowerCAmelCase	:				str					  =       string.digits.maketrans("",     "",     string.digits)
																					_lowerCAmelCase	:				List[Any]					  =       np.char.translate(lowerCAmelCase_,     table=lowerCAmelCase_)
																					_lowerCAmelCase	:				Union[str, Any]					  =       np.char.translate(lowerCAmelCase_,     table=lowerCAmelCase_)

														_lowerCAmelCase	:				List[str]					  =       predictions == references

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




'''simple docstring'''





import math






def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: int ):






			"""simple docstring"""




			if not isinstance(_SCREAMING_SNAKE_CASE,_SCREAMING_SNAKE_CASE ):
						__A=	f"""Input value of [number={number}] must be an integer"""
						raise TypeError(_SCREAMING_SNAKE_CASE )

			if number < 1:
						__A=	f"""Input value of [number={number}] must be > 0"""
						raise ValueError(_SCREAMING_SNAKE_CASE )
			elif number == 1:
						return 3
			elif number == 2:
						return 5
			else:
						__A=	int(math.log(number // 3,2 ) ) + 2

						__A=	[3, 5]
						__A=	2
						__A=	3
						for block in range(1,_SCREAMING_SNAKE_CASE ):
									for _ in range(_SCREAMING_SNAKE_CASE ):
												proth_list.append(2 ** (block + 1) + proth_list[proth_index - 1] )
												proth_index += 1
									increment *= 2

			return proth_list[number - 1]


if __name__ == "__main__":
					import doctest

					doctest.testmod()

					for number in range(1_1):
										UpperCAmelCase__  			=				0
										try:
															UpperCAmelCase__  			=				proth(number)
										except ValueError:
															print(F"""ValueError: there is no {number}th Proth number""")
															continue

										print(F"""The {number}th Proth number: {value}""")



