(s)
| 183 | |
| 184 | if mode in ['qa']: |
| 185 | def normalize_answer_qa(s): |
| 186 | def remove_articles(text): |
| 187 | return re.sub(r"\b(a|an|the)\b", " ", text) |
| 188 | def white_space_fix(text): |
| 189 | return " ".join(text.strip().split()) |
| 190 | def remove_punc(text): |
| 191 | exclude = set(string.punctuation) |
| 192 | return "".join(ch for ch in text if ch not in exclude) |
| 193 | def lower(text): |
| 194 | return text.lower() |
| 195 | return white_space_fix(remove_articles(remove_punc(lower(s)))) |
| 196 | normalized_pred_answer = normalize_answer_qa(pred_answer_new) |
| 197 | |
| 198 | for answer in labeled_answer: |
no test coverage detected