Datasets:
Commit
•
b794b73
1
Parent(s):
519f8e6
Fix DuplicatedKeysError (#2)
Browse files- Fix DuplicatedKeysError (9ad52d95a8a8f567345d864cb9005e14a4a8de41)
- 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
|