sileod commited on
Commit
b611583
1 Parent(s): f38ac4b

Update mtop.py

Browse files
Files changed (1) hide show
  1. mtop.py +14 -13
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
- with open(f"{filepath}/mtop/en/{split}.txt", encoding="utf-8") as f:
88
- for example in f:
89
- example = example.split("\t")
90
- dict_example = dict(idx=example[0],
91
- intent=example[1],
92
- spans=example[2],
93
- question=example[3],
94
- domain=example[4],
95
- lang=example[5],
96
- logical_form=example[6],
97
- tokenized_question=example[7])
98
- yield key, dict_example
99
- key += 1
 
 
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