|
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] |
|
] |
|
|
|
|