Skip to content

Commit 84c884d

Browse files
author
Alex-Fabbri
committed
update tfds.features.Sequence and fname as key
1 parent b7d35c2 commit 84c884d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tensorflow_datasets/summarization/opinosis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _info(self):
4141
description=_DESCRIPTION,
4242
features=tfds.features.FeaturesDict({
4343
_REVIEW_SENTS: tfds.features.Text(),
44-
_SUMMARIES: tfds.features.Text(),
44+
_SUMMARIES: tfds.features.Sequence(tfds.features.Text())
4545
}),
4646
supervised_keys=(_REVIEW_SENTS, _SUMMARIES),
4747
homepage='http://kavita-ganesan.com/opinosis/#.XeTZopNKhTY',
@@ -62,7 +62,7 @@ def _generate_examples(self, path=None):
6262
"""Yields examples."""
6363
topics_path = os.path.join(path, "topics")
6464
filenames = tf.io.gfile.listdir(topics_path)
65-
for i, filename in enumerate(filenames):
65+
for filename in filenames:
6666
file_path = os.path.join(topics_path, filename)
6767
topic_name = filename.split(".txt")[0]
6868
with tf.io.gfile.GFile(file_path, "rb") as src_f:
@@ -74,8 +74,8 @@ def _generate_examples(self, path=None):
7474
with tf.io.gfile.GFile(file_path, "rb") as tgt_f:
7575
data = tgt_f.read()
7676
summary_lst.append(data)
77-
summary_data = b"[SEP_SUM]".join(summary_lst)
78-
yield i, {
77+
summary_data = summary_lst
78+
yield filename, {
7979
_REVIEW_SENTS: input_data,
8080
_SUMMARIES: summary_data
8181
}

0 commit comments

Comments
 (0)