Markus28 commited on
Commit
8d90ccb
1 Parent(s): 927e7c6

handle case of duplicate passages

Browse files
Files changed (1) hide show
  1. spanish_passage_retrieval.py +5 -1
spanish_passage_retrieval.py CHANGED
@@ -106,12 +106,16 @@ class PRES(datasets.GeneratorBasedBuilder):
106
  qrels_s2s[qid] = []
107
  qrels_s2p[qid] = []
108
 
 
 
109
  for annotated_topic in rel_passages['topics']:
110
  topic = annotated_topic['number']
111
  for annotation in annotated_topic['annotations']:
112
  passage_id = f'doc_{annotation["docNo"]}_{annotation["start"]}_{annotation["end"]}'
113
  doc_id = f'doc_{annotation["docNo"]}'
114
- corpus_sentences.append({'_id': passage_id, 'text': annotation['text']})
 
 
115
  for qid in topic_to_queries[topic]:
116
  qrels_s2s[qid].append(passage_id)
117
  qrels_s2p[qid].append(doc_id)
 
106
  qrels_s2s[qid] = []
107
  qrels_s2p[qid] = []
108
 
109
+ known_passage_ids = set()
110
+
111
  for annotated_topic in rel_passages['topics']:
112
  topic = annotated_topic['number']
113
  for annotation in annotated_topic['annotations']:
114
  passage_id = f'doc_{annotation["docNo"]}_{annotation["start"]}_{annotation["end"]}'
115
  doc_id = f'doc_{annotation["docNo"]}'
116
+ if passage_id not in known_passage_ids:
117
+ corpus_sentences.append({'_id': passage_id, 'text': annotation['text']})
118
+ known_passage_ids.add(passage_id)
119
  for qid in topic_to_queries[topic]:
120
  qrels_s2s[qid].append(passage_id)
121
  qrels_s2p[qid].append(doc_id)