Update ccnews_split.py
Browse files- ccnews_split.py +1 -14
ccnews_split.py
CHANGED
@@ -105,13 +105,7 @@ class CCNews(datasets.GeneratorBasedBuilder):
|
|
105 |
description=_DESCRIPTION,
|
106 |
features=datasets.Features(
|
107 |
{
|
108 |
-
"title": datasets.Value("string"),
|
109 |
"text": datasets.Value("string"),
|
110 |
-
"domain": datasets.Value("string"),
|
111 |
-
"date": datasets.Value("string"),
|
112 |
-
"description": datasets.Value("string"),
|
113 |
-
"url": datasets.Value("string"),
|
114 |
-
"image_url": datasets.Value("string"),
|
115 |
}
|
116 |
),
|
117 |
supervised_keys=None,
|
@@ -141,14 +135,7 @@ class CCNews(datasets.GeneratorBasedBuilder):
|
|
141 |
article = json.load(f)
|
142 |
if level == "sentence":
|
143 |
full_article = article["maintext"].strip() if article["maintext"] is not None else ""
|
144 |
-
doc_dict = {
|
145 |
-
"title": article["title"].strip() if article["title"] is not None else "",
|
146 |
-
"domain": article["source_domain"].strip() if article["source_domain"] is not None else "",
|
147 |
-
"date": article["date_publish"].strip() if article["date_publish"] is not None else "",
|
148 |
-
"description": article["description"].strip() if article["description"] is not None else "",
|
149 |
-
"url": article["url"].strip() if article["url"] is not None else "",
|
150 |
-
"image_url": article["image_url"].strip() if article["image_url"] is not None else "",
|
151 |
-
}
|
152 |
for sent in full_article.split("\n"):
|
153 |
doc_dict["text"] = sent
|
154 |
yield id_, doc_dict
|
|
|
105 |
description=_DESCRIPTION,
|
106 |
features=datasets.Features(
|
107 |
{
|
|
|
108 |
"text": datasets.Value("string"),
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
),
|
111 |
supervised_keys=None,
|
|
|
135 |
article = json.load(f)
|
136 |
if level == "sentence":
|
137 |
full_article = article["maintext"].strip() if article["maintext"] is not None else ""
|
138 |
+
doc_dict = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
for sent in full_article.split("\n"):
|
140 |
doc_dict["text"] = sent
|
141 |
yield id_, doc_dict
|