File size: 3,594 Bytes
94a1be9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
import datasets
from datasets import Value, Sequence
PROCESS_FILES = [
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000001.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000002.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000003.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000004.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000005.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000006.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000007.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000008.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000009.parquet",
"https://huggingface.co/datasets/korean-corpus/namu/resolve/main/processed/namuwiki210301-processed-000010.parquet",
]
class NamuWikiConfig(datasets.BuilderConfig):
"""BuilderConfig for NamuWiki"""
def __init__(self, features, data_url, citation, url, **kwargs):
"""BuilderConfig for NamuWiki.
Args:
**kwargs: keyword arguments forwarded to super.
"""
super().__init__(version=datasets.Version("1.0.2"), **kwargs)
self.features = features
self.data_url = data_url
self.citation = citation
self.url = url
SUB_DATASETS = [
NamuWikiConfig(
name="raw",
features=datasets.Features(
{
"title": Value(dtype='string', id=None),
"text": Value(dtype='string', id=None),
"contributors": Sequence(feature=Value(dtype='string', id=None), length=-1, id=None)
}
),
data_url="https://www.dropbox.com/s/03b49jdrx7xi712/namuwiki210301.7z?dl=1",
citation="",
url="",
),
NamuWikiConfig(
name="processed",
features=datasets.Features(
{
"id": Value(dtype='string', id=None),
"title": Value(dtype='string', id=None),
"text": Value(dtype='string', id=None),
}
),
data_url=PROCESS_FILES,
citation="",
url="",
),
]+[
NamuWikiConfig(
name=f"char-{length}",
features=datasets.Features(
{
"id": Value(dtype='string', id=None),
"title": Value(dtype='string', id=None),
"text": Value(dtype='string', id=None),
}
),
data_url=PROCESS_FILES,
citation="",
url="",
) for length in [32, 64, 128, 256, 512]
]+[
NamuWikiConfig(
name=f"word-{length}",
features=datasets.Features({
"id": Value(dtype='string', id=None),
"title": Value(dtype='string', id=None),
"text": Value(dtype='string', id=None),
}),
data_url=PROCESS_FILES,
citation="",
url="",
) for length in [32, 64, 128, 256, 512]
]
|