initial
Browse files- common_crawl.py +3 -2
common_crawl.py
CHANGED
@@ -60,6 +60,7 @@ class CommonCrawl(datasets.GeneratorBasedBuilder):
|
|
60 |
description="",
|
61 |
features=Features(
|
62 |
{
|
|
|
63 |
"text": Value("string"),
|
64 |
}
|
65 |
),
|
@@ -74,7 +75,7 @@ class CommonCrawl(datasets.GeneratorBasedBuilder):
|
|
74 |
|
75 |
def _generate_examples(self, filepath):
|
76 |
logger.info("generating examples from = %s", filepath)
|
77 |
-
for record in ArchiveIterator(requests.get(filepath.split("::")[1], stream=True).raw, arc2warc=True):
|
78 |
if record.rec_type == 'response' and record.http_headers.get_header('Content-Type') == 'text/html':
|
79 |
text = _decode_text(record.content_stream().read())
|
80 |
-
yield "
|
|
|
60 |
description="",
|
61 |
features=Features(
|
62 |
{
|
63 |
+
"id": Value("int32"),
|
64 |
"text": Value("string"),
|
65 |
}
|
66 |
),
|
|
|
75 |
|
76 |
def _generate_examples(self, filepath):
|
77 |
logger.info("generating examples from = %s", filepath)
|
78 |
+
for i, record in enumerate(ArchiveIterator(requests.get(filepath.split("::")[1], stream=True).raw, arc2warc=True)):
|
79 |
if record.rec_type == 'response' and record.http_headers.get_header('Content-Type') == 'text/html':
|
80 |
text = _decode_text(record.content_stream().read())
|
81 |
+
yield i, {"id": i, "text": str(text)}
|