Datasets:

ArXiv:
License:
adwaitagashe commited on
Commit
f2af518
1 Parent(s): 057e1e1

load query language into dict.

Browse files
Files changed (1) hide show
  1. bordirlines.py +4 -0
bordirlines.py CHANGED
@@ -102,6 +102,7 @@ class BordIRLinesDataset(datasets.GeneratorBasedBuilder):
102
  {
103
  "query_id": datasets.Value("string"),
104
  "query": datasets.Value("string"),
 
105
  "territory": datasets.Value("string"),
106
  "rank": datasets.Value("int32"),
107
  "score": datasets.Value("float32"),
@@ -149,6 +150,7 @@ class BordIRLinesDataset(datasets.GeneratorBasedBuilder):
149
  n_hits = self.config.n_hits
150
  queries_df = pd.read_csv(queries_path, sep="\t")
151
  query_map = dict(zip(queries_df["query_id"], queries_df["query_text"]))
 
152
  counter = 0
153
 
154
  docs = load_json(docs_path)
@@ -167,11 +169,13 @@ class BordIRLinesDataset(datasets.GeneratorBasedBuilder):
167
  doc_lang = row["doc_lang"]
168
  query_id = row["query_id"]
169
  query_text = query_map[query_id]
 
170
  yield (
171
  counter,
172
  {
173
  "query_id": query_id,
174
  "query": query_text,
 
175
  "territory": row["territory"],
176
  "rank": row["rank"],
177
  "score": row["score"],
 
102
  {
103
  "query_id": datasets.Value("string"),
104
  "query": datasets.Value("string"),
105
+ "query_lang": datasets.Value("string"),
106
  "territory": datasets.Value("string"),
107
  "rank": datasets.Value("int32"),
108
  "score": datasets.Value("float32"),
 
150
  n_hits = self.config.n_hits
151
  queries_df = pd.read_csv(queries_path, sep="\t")
152
  query_map = dict(zip(queries_df["query_id"], queries_df["query_text"]))
153
+ query_to_lang_map = dict(zip(queries_df["query_id"], queries_df["language"]))
154
  counter = 0
155
 
156
  docs = load_json(docs_path)
 
169
  doc_lang = row["doc_lang"]
170
  query_id = row["query_id"]
171
  query_text = query_map[query_id]
172
+ query_lang = query_to_lang_map[query_id]
173
  yield (
174
  counter,
175
  {
176
  "query_id": query_id,
177
  "query": query_text,
178
+ "query_lang": query_lang,
179
  "territory": row["territory"],
180
  "rank": row["rank"],
181
  "score": row["score"],