(s)
| 60 | return '\n'.join(lines) |
| 61 | |
| 62 | def normalize_answer(s): |
| 63 | def remove_articles(text): |
| 64 | return re.sub(r"\b(a|an|the)\b", " ", text) |
| 65 | |
| 66 | def white_space_fix(text): |
| 67 | return " ".join(text.split()) |
| 68 | |
| 69 | def remove_punc(text): |
| 70 | exclude = set(string.punctuation) |
| 71 | return "".join(ch for ch in text if ch not in exclude) |
| 72 | |
| 73 | def lower(text): |
| 74 | return text.lower() |
| 75 | |
| 76 | return white_space_fix(remove_articles(remove_punc(lower(s)))) |
| 77 | |
| 78 | def f1_score(prediction, ground_truth): |
| 79 | normalized_prediction = normalize_answer(prediction) |
no test coverage detected