(path: str)
| 14 | |
| 15 | @staticmethod |
| 16 | def load(path: str): |
| 17 | path = get_data_path(path, local_mode=True) |
| 18 | src_lines = open(path, 'r', encoding='utf-8').readlines() |
| 19 | data = {'question': [], 'answer': []} |
| 20 | for lines in src_lines: |
| 21 | question, answer = lines.strip().split('\t') |
| 22 | data['question'].append(question) |
| 23 | data['answer'].append(answer) |
| 24 | |
| 25 | dataset = Dataset.from_dict({ |
| 26 | 'question': data['question'], |
| 27 | 'answer': data['answer'] |
| 28 | }) |
| 29 | return dataset |
| 30 | |
| 31 | |
| 32 | LANG_TO_ANSWER_PREFIX = { |
nothing calls this directly
no test coverage detected