-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidator.py
24 lines (20 loc) · 971 Bytes
/
validator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class HotpotEntryValidator():
def validate(hotpot_entry):
error_messages = []
if "question" not in hotpot_entry:
error_messages.append("Missing question field")
if "answer" not in hotpot_entry:
error_messages.append("Missing answer field")
if "supporting_facts" not in hotpot_entry:
error_messages.append("Missing supporting_facts field")
else:
if "title" not in hotpot_entry['supporting_facts']:
error_messages.append("Missing supporting_facts.title field")
if "context" not in hotpot_entry:
error_messages.append("Missing context field")
else:
if "title" not in hotpot_entry['context']:
error_messages.append("Missing context.title field")
if "sentences" not in hotpot_entry['context']:
error_messages.append("Missing context.sentences field")
return error_messages