def get_pred_text(eval_dict, example_ids, pred_starts, pred_ends, probs, use_official_ids=False):
    """Get text of predicted answers for a number of predicted starts, ends, and the corresponding example_ids.
    If use_official_ids is True, the returned dictionary maps from official UUIDs to predicted (answer text, prob) pairs.
    Otherwise, maps from simple numeric IDs to (answer text, prob) pairs.
    """
    pred_text = {}
    for example_id, pred_start, pred_end, prob in zip(example_ids, pred_starts, pred_ends, probs):
        context = eval_dict[str(example_id)]['c']
        bounds = eval_dict[str(example_id)]['bounds']
        start_idx = bounds[pred_start][0]
        end_idx = bounds[pred_end][1]
        if use_official_ids:
            official_id = eval_dict[str(example_id)]['id']
            pred_text[official_id] = (context[start_idx: end_idx], prob)
        else:
            pred_text[str(example_id)] = (context[start_idx: end_idx], prob)
    return pred_text