






"""simple docstring"""



import math
def 						_SCREAMING_SNAKE_CASE (    __snake_case			:  int    ):





  '''simple docstring'''





  if 1 < number < 4:
    # 2 and 3 are primes
    return True
  elif number < 2 or number % 2 == 0 or number % 3 == 0:
    # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
    return False

  # All primes number are in format of 6k +/- 1
  for i in range(5		,					int(math.sqrt(__snake_case    ) + 1    )		,					6    ):
    if number % i == 0 or number % (i + 2) == 0:
      return False
  return True
def 						_SCREAMING_SNAKE_CASE (    __snake_case			:  float = 0.1    ):





  '''simple docstring'''





  lowercase							    =       3
  lowercase							    =       3

  while primes / (2 * j - 1) >= ratio:
    for i in range(j * j + j + 1		,					(j + 2) * (j + 2)		,					j + 1    ):
      primes += is_prime(__snake_case    )
    j += 2
  return j


if __name__ == "__main__":
    import doctest

    doctest.testmod()










"""simple docstring"""



import argparse
import json

from tqdm import tqdm
def 						_SCREAMING_SNAKE_CASE (    ):





  '''simple docstring'''





  lowercase							    =       argparse.ArgumentParser()

  # Required parameters
  parser.add_argument(
      '--src_path'		,					type=__snake_case		,					default='biencoder-nq-dev.json'		,					help='Path to raw DPR training data'		,					)
  parser.add_argument(
      '--evaluation_set'		,					type=__snake_case		,					help='where to store parsed evaluation_set file'		,					)
  parser.add_argument(
      '--gold_data_path'		,					type=__snake_case		,					help='where to store parsed gold_data_path file'		,					)
  lowercase							    =       parser.parse_args()

  with open(args.src_path		,					'r'    ) as src_file, open(args.evaluation_set		,					'w'    ) as eval_file, open(
      args.gold_data_path		,					'w'    ) as gold_file:
    lowercase							    =       json.load(__snake_case    )
    for dpr_record in tqdm(__snake_case    ):
      lowercase							    =       dpr_record['question']
      lowercase							    =       [context['title'] for context in dpr_record['positive_ctxs']]
      eval_file.write(question + '\n'    )
      gold_file.write('\t'.join(__snake_case    ) + '\n'    )


if __name__ == "__main__":
    main()


