

"""simple docstring"""




import argparse
import json
import re
import string
import sys
from collections import Counter
def   __SCREAMING_SNAKE_CASE		(		lowercase__ ):
					"""simple docstring"""

					def remove_articles(lowercase__ ):
										return re.sub(r"\b(a|an|the)\b"     ,				" "     ,				lowercase__ )

					def white_space_fix(lowercase__ ):
										return " ".join(text.split() )

					def remove_punc(lowercase__ ):
										A     =   set(string.punctuation )
										return "".join(ch for ch in text if ch not in exclude )

					def lower(lowercase__ ):
										return text.lower()

					return white_space_fix(remove_articles(remove_punc(lower(lowercase__ ) ) ) )
def   __SCREAMING_SNAKE_CASE		(		lowercase__     ,				lowercase__ ):
					"""simple docstring"""
					A     =   normalize_answer(lowercase__ ).split()
					A     =   normalize_answer(lowercase__ ).split()
					A     =   Counter(lowercase__ ) & Counter(lowercase__ )
					A     =   sum(common.values() )
					if num_same == 0:
										return 0
					A     =   1.0 * num_same / len(lowercase__ )
					A     =   1.0 * num_same / len(lowercase__ )
					A     =   (2 * precision * recall) / (precision + recall)
					return fa
def   __SCREAMING_SNAKE_CASE		(		lowercase__     ,				lowercase__ ):
					"""simple docstring"""
					return normalize_answer(lowercase__ ) == normalize_answer(lowercase__ )
def   __SCREAMING_SNAKE_CASE		(		lowercase__     ,				lowercase__     ,				lowercase__ ):
					"""simple docstring"""
					A     =   []
					for ground_truth in ground_truths:
										A     =   metric_fn(lowercase__     ,				lowercase__ )
										scores_for_ground_truths.append(lowercase__ )
					return max(lowercase__ )
def   __SCREAMING_SNAKE_CASE		(		lowercase__     ,				lowercase__ ):
					"""simple docstring"""
					A     =   A     =   A     =   0
					for article in dataset:
										for paragraph in article["paragraphs"]:
															for qa in paragraph["qas"]:
																				total += 1
																				if qa["id"] not in predictions:
																									A     =   "Unanswered question " + qa["id"] + " will receive score 0."
																									print(lowercase__     ,				file=sys.stderr )
																									continue
																				A     =   [x["text"] for x in qa["answers"]]
																				A     =   predictions[qa["id"]]
																				exact_match += metric_max_over_ground_truths(lowercase__     ,				lowercase__     ,				lowercase__ )
																				fa += metric_max_over_ground_truths(lowercase__     ,				lowercase__     ,				lowercase__ )

					A     =   1_00.0 * exact_match / total
					A     =   1_00.0 * fa / total

					return {"exact_match": exact_match, "f1": fa}


if __name__ == "__main__":
	__A	:       Union[str, Any]        =						'1.1'
	__A	:       List[str]        =						argparse.ArgumentParser(description='Evaluation for SQuAD ' + expected_version)
	parser.add_argument('dataset_file', help='Dataset file')
	parser.add_argument('prediction_file', help='Prediction File')
	__A	:       int        =						parser.parse_args()
	with open(args.dataset_file) as dataset_file:
		__A	:       Optional[Any]        =						json.load(dataset_file)
		if dataset_json["version"] != expected_version:
			print(
			    'Evaluation expects v-' + expected_version + ', but got dataset with v-' + dataset_json['version'],
			    file=sys.stderr,
			)
		__A	:       int        =						dataset_json['data']
	with open(args.prediction_file) as prediction_file:
		__A	:       Union[str, Any]        =						json.load(prediction_file)
	print(json.dumps(evaluate(dataset, predictions)))










"""simple docstring"""







import unittest
from timeit import timeit

def 							UpperCamelCase_       (       lowerCAmelCase__ :							int       ,  lowerCAmelCase__ :							int		)		->  int:

  """simple docstring"""




  lowerCAmelCase_  :							Any								=					first_num if first_num >= second_num else second_num
  lowerCAmelCase_  :							Union[str, Any]								=					max_num
  while (common_mult % first_num > 0) or (common_mult % second_num > 0):
    common_mult += max_num
  return common_mult

def 							UpperCamelCase_       (       lowerCAmelCase__ :							int       ,  lowerCAmelCase__ :							int		)		->  int:

  """simple docstring"""




  return b if a == 0 else greatest_common_divisor(b % a       ,  lowerCAmelCase__		)

def 							UpperCamelCase_       (       lowerCAmelCase__ :							int       ,  lowerCAmelCase__ :							int		)		->  int:

  """simple docstring"""




  return first_num // greatest_common_divisor(lowerCAmelCase__       ,  lowerCAmelCase__		) * second_num

def 							UpperCamelCase_       (       )		->  Dict:

  """simple docstring"""




  lowerCAmelCase_  :							str								=					(
      'from __main__ import least_common_multiple_slow, least_common_multiple_fast'
  )
  print(
      'least_common_multiple_slow():'       ,  timeit('least_common_multiple_slow(1000, 999)'       ,  setup=lowerCAmelCase__		)       ,  )
  print(
      'least_common_multiple_fast():'       ,  timeit('least_common_multiple_fast(1000, 999)'       ,  setup=lowerCAmelCase__		)       ,  )







class  UpperCamelCase__  (      unittest.TestCase    ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE    							=	(
          (10, 20),
          (13, 15),
          (4, 31),
          (10, 42),
          (43, 34),
          (5, 12),
          (12, 25),
          (10, 25),
          (6, 9),
      )
      _SCREAMING_SNAKE_CASE    							=	(20, 195, 124, 210, 1462, 60, 300, 50, 18)



      def 	SCREAMING_SNAKE_CASE__					( self							: List[str]			):
        for i, (first_num, second_num) in enumerate(self.test_inputs			):
          lowerCAmelCase_  :							Union[str, Any]								=					least_common_multiple_slow(SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_			)
          lowerCAmelCase_  :							Any								=					least_common_multiple_fast(SCREAMING_SNAKE_CASE_       ,     SCREAMING_SNAKE_CASE_			)
          with self.subTest(i=SCREAMING_SNAKE_CASE_			):
            self.assertEqual(SCREAMING_SNAKE_CASE_       ,     self.expected_results[i]			)
            self.assertEqual(SCREAMING_SNAKE_CASE_       ,     self.expected_results[i]			)


if __name__ == "__main__":
     benchmark()
     unittest.main()





