Properly fixing the topics generation examples script.
Browse files
quati.py
CHANGED
@@ -68,26 +68,26 @@ def generate_examples_qrels(filepath):
|
|
68 |
|
69 |
with open(filepath, encoding="utf-8") as input_file:
|
70 |
for (idx, line) in enumerate(input_file):
|
71 |
-
|
72 |
-
query_id, _, passage_id, score = line.rstrip().split(" ")
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
|
78 |
-
|
79 |
|
80 |
|
81 |
def generate_examples_topics(filepath):
|
82 |
|
83 |
with open(filepath, encoding="utf-8") as input_file:
|
84 |
for (idx, line) in enumerate(input_file):
|
85 |
-
|
|
|
86 |
|
87 |
-
|
88 |
-
|
89 |
|
90 |
-
|
91 |
|
92 |
|
93 |
|
|
|
68 |
|
69 |
with open(filepath, encoding="utf-8") as input_file:
|
70 |
for (idx, line) in enumerate(input_file):
|
71 |
+
query_id, _, passage_id, score = line.rstrip().split(" ")
|
|
|
72 |
|
73 |
+
features = {"query_id": int(query_id),
|
74 |
+
"passage_id": passage_id,
|
75 |
+
"score": int(score)}
|
76 |
|
77 |
+
yield idx, features
|
78 |
|
79 |
|
80 |
def generate_examples_topics(filepath):
|
81 |
|
82 |
with open(filepath, encoding="utf-8") as input_file:
|
83 |
for (idx, line) in enumerate(input_file):
|
84 |
+
if idx > 0:
|
85 |
+
query_id, query = line.rstrip().split("\t")
|
86 |
|
87 |
+
features = {"query_id": int(query_id),
|
88 |
+
"query": query}
|
89 |
|
90 |
+
yield idx - 1, features
|
91 |
|
92 |
|
93 |
|