initial
Browse files- common_crawl.py +15 -2
common_crawl.py
CHANGED
@@ -7,7 +7,7 @@ from typing import Optional
|
|
7 |
from warcio.archiveiterator import ArchiveIterator
|
8 |
|
9 |
from datasets import (
|
10 |
-
BuilderConfig, Version, GeneratorBasedBuilder, DownloadManager, SplitGenerator, Split
|
11 |
)
|
12 |
|
13 |
|
@@ -67,4 +67,17 @@ class CommonCrawl(GeneratorBasedBuilder):
|
|
67 |
if record.rec_type == 'response' and record.http_headers.get_header('Content-Type') == 'text/html':
|
68 |
text = self._process(_decode_text(record.content_stream().read()))
|
69 |
if self.detect_languages(text):
|
70 |
-
yield {"text": text}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
from warcio.archiveiterator import ArchiveIterator
|
8 |
|
9 |
from datasets import (
|
10 |
+
BuilderConfig, Version, GeneratorBasedBuilder, DownloadManager, SplitGenerator, Split, Features, Value, DatasetInfo
|
11 |
)
|
12 |
|
13 |
|
|
|
67 |
if record.rec_type == 'response' and record.http_headers.get_header('Content-Type') == 'text/html':
|
68 |
text = self._process(_decode_text(record.content_stream().read()))
|
69 |
if self.detect_languages(text):
|
70 |
+
yield {"text": text}
|
71 |
+
|
72 |
+
def _info(self):
|
73 |
+
return DatasetInfo(
|
74 |
+
description="",
|
75 |
+
features=Features(
|
76 |
+
{
|
77 |
+
"text": Value("string"),
|
78 |
+
}
|
79 |
+
),
|
80 |
+
supervised_keys=None,
|
81 |
+
homepage="https://github.com/hkjeon13",
|
82 |
+
citation="",
|
83 |
+
)
|