Datasets:
Commit
•
9ad52d9
1
Parent(s):
519f8e6
Fix DuplicatedKeysError
Browse files- taskmaster2.py +3 -1
taskmaster2.py
CHANGED
@@ -115,6 +115,7 @@ class Taskmaster2(datasets.GeneratorBasedBuilder):
|
|
115 |
]
|
116 |
|
117 |
def _generate_examples(self, filepath):
|
|
|
118 |
with open(filepath, encoding="utf-8") as f:
|
119 |
dialogs = json.load(f)
|
120 |
for dialog in dialogs:
|
@@ -122,4 +123,5 @@ class Taskmaster2(datasets.GeneratorBasedBuilder):
|
|
122 |
for utterance in utterances:
|
123 |
if "segments" not in utterance:
|
124 |
utterance["segments"] = []
|
125 |
-
yield
|
|
|
|
115 |
]
|
116 |
|
117 |
def _generate_examples(self, filepath):
|
118 |
+
key = 0
|
119 |
with open(filepath, encoding="utf-8") as f:
|
120 |
dialogs = json.load(f)
|
121 |
for dialog in dialogs:
|
|
|
123 |
for utterance in utterances:
|
124 |
if "segments" not in utterance:
|
125 |
utterance["segments"] = []
|
126 |
+
yield key, dialog
|
127 |
+
key += 1
|