File size: 546 Bytes
66853f7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from pyserini.search import get_topics, get_qrels
import json
topics = get_topics('dl19-passage')
qrels = get_qrels('dl19-passage')
with open('dl19.jsonl', 'w') as f:
for topic_id in qrels:
query_id = topic_id
query = topics[query_id]['title']
positive_passages = []
negative_passages = []
f.write(json.dumps({
'query_id': str(query_id),
'query': query,
'positive_passages': positive_passages,
'negative_passages': negative_passages,
}) + '\n') |