(self, doc)
| 52 | return map(self._process_doc, self.dataset["test"]) |
| 53 | |
| 54 | def _process_doc(self, doc): |
| 55 | # NOTE: Some `doc["answerKey"]`s are in numeric string format being one |
| 56 | # of {'1', '2', '3', '4', '5'}. We map them back to letters. |
| 57 | num_to_letter = {"1": "A", "2": "B", "3": "C", "4": "D", "5": "E"} |
| 58 | doc["answerKey"] = num_to_letter.get(doc["answerKey"], doc["answerKey"]) |
| 59 | out_doc = { |
| 60 | "id": doc["id"], |
| 61 | "query": "Question: " + doc["question"] + "\nAnswer:", |
| 62 | "choices": doc["choices"]["text"], |
| 63 | "gold": ["A", "B", "C", "D", "E"].index(doc["answerKey"]), |
| 64 | } |
| 65 | return out_doc |
| 66 | |
| 67 | def doc_to_text(self, doc): |
| 68 | return doc["query"] |
nothing calls this directly
no outgoing calls
no test coverage detected