Skip to content

Commit

Permalink
Replace None value to empty array in 'answer_aliases' sub-field for c…
Browse files Browse the repository at this point in the history
…onsistency in MKQA SEACrowd#34
  • Loading branch information
fhudi committed Mar 6, 2024
1 parent 6b52e7c commit 06baed3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion seacrowd/sea_datasets/mkqa/mkqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ def _generate_examples(self, filepath: Path) -> Tuple[int, Dict]:
"document_id": "",
"question": cur["queries"][cur_lang],
"type": "open_domain",
# "type": [ans["type"] for ans in cur["answers"][cur_lang]],
"choices": [],
"context": "",
"answer": [ans.get("text", None) for ans in cur["answers"][cur_lang]],
"meta": {f"answer_{k}": [ans.get(k, None) for ans in cur["answers"][cur_lang]] for k in ["entity", "aliases", "type"]},
}
ret["meta"]["answer_aliases"] = list(map(lambda a: [] if a is None else a, ret["meta"]["answer_aliases"]))
yield ret["id"], ret

0 comments on commit 06baed3

Please sign in to comment.