Datasets:
Update mtop.py
Browse files
mtop.py
CHANGED
@@ -84,16 +84,17 @@ class Mtop(datasets.GeneratorBasedBuilder):
|
|
84 |
def _generate_examples(self, filepath, split):
|
85 |
"""This function returns the examples in the raw (text) form."""
|
86 |
key = 0
|
87 |
-
|
88 |
-
|
89 |
-
example
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
84 |
def _generate_examples(self, filepath, split):
|
85 |
"""This function returns the examples in the raw (text) form."""
|
86 |
key = 0
|
87 |
+
for lang in "de en es fr hi th".split():
|
88 |
+
with open(f"{filepath}/mtop/{lang}/{split}.txt", encoding="utf-8") as f:
|
89 |
+
for example in f:
|
90 |
+
example = example.split("\t")
|
91 |
+
dict_example = dict(idx=example[0],
|
92 |
+
intent=example[1],
|
93 |
+
spans=example[2],
|
94 |
+
question=example[3],
|
95 |
+
domain=example[4],
|
96 |
+
lang=example[5],
|
97 |
+
logical_form=example[6],
|
98 |
+
tokenized_question=example[7])
|
99 |
+
yield key, dict_example
|
100 |
+
key += 1
|