Commit
·
e4c4e01
1
Parent(s):
6ca4f77
Update dialogsum_reformat.py
Browse files- dialogsum_reformat.py +25 -4
dialogsum_reformat.py
CHANGED
|
@@ -111,15 +111,15 @@ class Dialogsum(datasets.GeneratorBasedBuilder):
|
|
| 111 |
downloaded_files = dl_manager.download_and_extract(_URLS)
|
| 112 |
return [
|
| 113 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
| 114 |
-
datasets.SplitGenerator(name=datasets.Split.
|
| 115 |
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["val"]}),
|
| 116 |
]
|
| 117 |
|
| 118 |
-
def _generate_examples(self, filepath
|
| 119 |
"""This function returns the examples in the raw (text) form."""
|
| 120 |
logger.info("generating examples from = %s", filepath)
|
| 121 |
key = 0
|
| 122 |
-
with open(
|
| 123 |
data = json.load(f)
|
| 124 |
|
| 125 |
for info in data :
|
|
@@ -134,4 +134,25 @@ class Dialogsum(datasets.GeneratorBasedBuilder):
|
|
| 134 |
"summary" : dialogue_summary,
|
| 135 |
"topic" : dialogue_topic,
|
| 136 |
}
|
| 137 |
-
key += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
downloaded_files = dl_manager.download_and_extract(_URLS)
|
| 112 |
return [
|
| 113 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
| 114 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
| 115 |
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["val"]}),
|
| 116 |
]
|
| 117 |
|
| 118 |
+
def _generate_examples(self, filepath):
|
| 119 |
"""This function returns the examples in the raw (text) form."""
|
| 120 |
logger.info("generating examples from = %s", filepath)
|
| 121 |
key = 0
|
| 122 |
+
with open(filepath) as f :
|
| 123 |
data = json.load(f)
|
| 124 |
|
| 125 |
for info in data :
|
|
|
|
| 134 |
"summary" : dialogue_summary,
|
| 135 |
"topic" : dialogue_topic,
|
| 136 |
}
|
| 137 |
+
key += 1
|
| 138 |
+
|
| 139 |
+
# def _generate_examples(self, filepath, split):
|
| 140 |
+
# """This function returns the examples in the raw (text) form."""
|
| 141 |
+
# logger.info("generating examples from = %s", filepath)
|
| 142 |
+
# key = 0
|
| 143 |
+
# with open(os.path.join(filepath, split)) as f :
|
| 144 |
+
# data = json.load(f)
|
| 145 |
+
|
| 146 |
+
# for info in data :
|
| 147 |
+
# dialogue_id = info['id']
|
| 148 |
+
# dialogue_name = info['dialogue']
|
| 149 |
+
# dialogue_summary = info['summary']
|
| 150 |
+
# dialogue_topic = info['topic']
|
| 151 |
+
|
| 152 |
+
# yield key, {
|
| 153 |
+
# "id" : dialogue_id,
|
| 154 |
+
# "dialogue" : dialogue_name,
|
| 155 |
+
# "summary" : dialogue_summary,
|
| 156 |
+
# "topic" : dialogue_topic,
|
| 157 |
+
# }
|
| 158 |
+
# key += 1
|