Commit
·
d617661
1
Parent(s):
ea085e0
up all
Browse files- de_head_0000_2015-48.txt.gz +3 -0
- german_common_crawl.py +243 -0
de_head_0000_2015-48.txt.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07d753f6a078ca3274a5b08620118a043597a25f71021ab8b28185322fc7ee52
|
| 3 |
+
size 1229259841
|
german_common_crawl.py
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""German Common Crawl"""
|
| 16 |
+
|
| 17 |
+
from __future__ import absolute_import, division, print_function
|
| 18 |
+
|
| 19 |
+
import os
|
| 20 |
+
|
| 21 |
+
import datasets
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
| 25 |
+
_CITATION = """\
|
| 26 |
+
@inproceedings{wenzek2020ccnet,
|
| 27 |
+
title={CCNet: Extracting High Quality Monolingual Datasets from Web Crawl Data},
|
| 28 |
+
author={Wenzek, Guillaume and Lachaux, Marie-Anne and Conneau, Alexis and Chaudhary, Vishrav and Guzm{\'a}n, Francisco and Joulin, Armand and Grave, {\'E}douard},
|
| 29 |
+
booktitle={Proceedings of The 12th Language Resources and Evaluation Conference},
|
| 30 |
+
pages={4003--4012},
|
| 31 |
+
year={2020}
|
| 32 |
+
}
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
+
_DESCRIPTION = """\
|
| 36 |
+
German Only Extract from Common Crawl
|
| 37 |
+
|
| 38 |
+
This Dataset is for pretraining a German Language Model (Unsupervised) or tune a Multilingual Model specifically to German
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
_URL_FIRST = [
|
| 42 |
+
"https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2015-48.txt.gz",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
_URL_HEAD = [
|
| 46 |
+
"https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2015-48.txt.gz",
|
| 47 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2016-18.txt.gz",
|
| 48 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2016-44.txt.gz",
|
| 49 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2017-13.txt.gz",
|
| 50 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2017-30.txt.gz",
|
| 51 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2017-39.txt.gz",
|
| 52 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2017-51.txt.gz",
|
| 53 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2018-09.txt.gz",
|
| 54 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2018-17.txt.gz",
|
| 55 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2018-30.txt.gz",
|
| 56 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2018-39.txt.gz",
|
| 57 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2018-51.txt.gz",
|
| 58 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2019-18.txt.gz",
|
| 59 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2019-30.txt.gz",
|
| 60 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2019-47.txt.gz",
|
| 61 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0000_2020-10.txt.gz",
|
| 62 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2016-44.txt.gz",
|
| 63 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2017-13.txt.gz",
|
| 64 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2017-30.txt.gz",
|
| 65 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2017-39.txt.gz",
|
| 66 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2017-51.txt.gz",
|
| 67 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2018-09.txt.gz",
|
| 68 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2018-17.txt.gz",
|
| 69 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2018-30.txt.gz",
|
| 70 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2018-39.txt.gz",
|
| 71 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2018-51.txt.gz",
|
| 72 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2019-09.txt.gz",
|
| 73 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2019-18.txt.gz",
|
| 74 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2019-30.txt.gz",
|
| 75 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2019-47.txt.gz",
|
| 76 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0001_2020-10.txt.gz",
|
| 77 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2016-44.txt.gz",
|
| 78 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2017-13.txt.gz",
|
| 79 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2017-30.txt.gz",
|
| 80 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2017-39.txt.gz",
|
| 81 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2017-51.txt.gz",
|
| 82 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2018-09.txt.gz",
|
| 83 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2018-17.txt.gz",
|
| 84 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2018-30.txt.gz",
|
| 85 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2018-39.txt.gz",
|
| 86 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2018-51.txt.gz",
|
| 87 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2019-09.txt.gz",
|
| 88 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2019-18.txt.gz",
|
| 89 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2019-30.txt.gz",
|
| 90 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2019-47.txt.gz",
|
| 91 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0002_2020-10.txt.gz",
|
| 92 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2016-44.txt.gz",
|
| 93 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2017-13.txt.gz",
|
| 94 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2017-30.txt.gz",
|
| 95 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2017-39.txt.gz",
|
| 96 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2017-51.txt.gz",
|
| 97 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2018-09.txt.gz",
|
| 98 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2018-17.txt.gz",
|
| 99 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2018-30.txt.gz",
|
| 100 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2018-39.txt.gz",
|
| 101 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2018-51.txt.gz",
|
| 102 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2019-09.txt.gz",
|
| 103 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2019-18.txt.gz",
|
| 104 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2019-30.txt.gz",
|
| 105 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2019-47.txt.gz",
|
| 106 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0003_2020-10.txt.gz",
|
| 107 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2016-44.txt.gz",
|
| 108 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2017-30.txt.gz",
|
| 109 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2017-39.txt.gz",
|
| 110 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2017-51.txt.gz",
|
| 111 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2018-09.txt.gz",
|
| 112 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2018-17.txt.gz",
|
| 113 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2018-30.txt.gz",
|
| 114 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2018-39.txt.gz",
|
| 115 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2018-51.txt.gz",
|
| 116 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2019-09.txt.gz",
|
| 117 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2019-18.txt.gz",
|
| 118 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2019-30.txt.gz",
|
| 119 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2019-47.txt.gz",
|
| 120 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0004_2020-10.txt.gz",
|
| 121 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2017-51.txt.gz",
|
| 122 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2018-09.txt.gz",
|
| 123 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2018-17.txt.gz",
|
| 124 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2018-30.txt.gz",
|
| 125 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2018-39.txt.gz",
|
| 126 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2018-51.txt.gz",
|
| 127 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2019-09.txt.gz",
|
| 128 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2019-18.txt.gz",
|
| 129 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2019-30.txt.gz",
|
| 130 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2019-47.txt.gz",
|
| 131 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0005_2020-10.txt.gz",
|
| 132 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2018-09.txt.gz",
|
| 133 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2018-17.txt.gz",
|
| 134 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2018-30.txt.gz",
|
| 135 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2018-39.txt.gz",
|
| 136 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2018-51.txt.gz",
|
| 137 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2019-09.txt.gz",
|
| 138 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2019-18.txt.gz",
|
| 139 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2019-30.txt.gz",
|
| 140 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2019-47.txt.gz",
|
| 141 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0006_2020-10.txt.gz",
|
| 142 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0007_2018-30.txt.gz",
|
| 143 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0007_2018-51.txt.gz",
|
| 144 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0007_2019-09.txt.gz",
|
| 145 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0007_2019-18.txt.gz",
|
| 146 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0007_2019-47.txt.gz",
|
| 147 |
+
# "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets/flax-community/german_common_crawl/de_head_0007_2020-10.txt.gz",
|
| 148 |
+
]
|
| 149 |
+
|
| 150 |
+
class GermanCommonCrawl(datasets.GeneratorBasedBuilder):
|
| 151 |
+
"""TODO: Short description of my dataset."""
|
| 152 |
+
|
| 153 |
+
VERSION = datasets.Version("1.1.0")
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
BUILDER_CONFIGS = [
|
| 157 |
+
datasets.BuilderConfig(name="first", version=VERSION, description="Only the first data file"),
|
| 158 |
+
datasets.BuilderConfig(name="head", version=VERSION, description="Only the head data"),
|
| 159 |
+
# datasets.BuilderConfig(name="middle", version=VERSION, description="Only the website text without metadata"),
|
| 160 |
+
# datasets.BuilderConfig(name="all", version=VERSION, description="Only the website text without metadata"),
|
| 161 |
+
]
|
| 162 |
+
|
| 163 |
+
def _info(self):
|
| 164 |
+
import ipdb; ipdb.set_trace()
|
| 165 |
+
if self.config.name == "data_only": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
| 166 |
+
features = datasets.Features(
|
| 167 |
+
{
|
| 168 |
+
"raw_content": datasets.Value("string"),
|
| 169 |
+
}
|
| 170 |
+
)
|
| 171 |
+
else: # This is an example to show how to have different features for "first_domain" and "second_domain"
|
| 172 |
+
features = datasets.Features(
|
| 173 |
+
{
|
| 174 |
+
"text": datasets.Value("string"),
|
| 175 |
+
"url": datasets.Value("string"),
|
| 176 |
+
"digest": datasets.Value("string"),
|
| 177 |
+
"length": datasets.Value("int32"),
|
| 178 |
+
"nlines": datasets.Value("int32"),
|
| 179 |
+
"source_domain": datasets.Value("string"),
|
| 180 |
+
"title": datasets.Value("string"),
|
| 181 |
+
"raw_content": datasets.Value("string"),
|
| 182 |
+
"cc_segment": datasets.Value("string"),
|
| 183 |
+
"original_nlines": datasets.Value("int32"),
|
| 184 |
+
"original_length": datasets.Value("int32"),
|
| 185 |
+
"language": datasets.Value("string"),
|
| 186 |
+
"perplexity": datasets.Value("int32"),
|
| 187 |
+
"bucket": datasets.Value("int32"),
|
| 188 |
+
|
| 189 |
+
}
|
| 190 |
+
)
|
| 191 |
+
return datasets.DatasetInfo(
|
| 192 |
+
# This is the description that will appear on the datasets page.
|
| 193 |
+
description=_DESCRIPTION,
|
| 194 |
+
# This defines the different columns of the dataset and their types
|
| 195 |
+
features=features, # Here we define them above because they are different between the two configurations
|
| 196 |
+
# If there's a common (input, txtget) tuple from the features,
|
| 197 |
+
# specify them here. They'll be used if as_supervised=True in
|
| 198 |
+
# builder.as_dataset.
|
| 199 |
+
supervised_keys=None,
|
| 200 |
+
# Citation for the dataset
|
| 201 |
+
citation=_CITATION,
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
+
def _split_generators(self, dl_manager):
|
| 205 |
+
"""Returns SplitGenerators."""
|
| 206 |
+
if self.config.name == "head":
|
| 207 |
+
data_dir = dl_manager.download_and_extract(_URL_HEAD)
|
| 208 |
+
else:
|
| 209 |
+
raise NotImplementedError("just `head` works for now")
|
| 210 |
+
|
| 211 |
+
import ipdb; ipdb.set_trace()
|
| 212 |
+
return [
|
| 213 |
+
datasets.SplitGenerator(
|
| 214 |
+
name=datasets.Split.TRAIN,
|
| 215 |
+
# These kwargs will be passed to _generate_examples
|
| 216 |
+
gen_kwargs={
|
| 217 |
+
"folderpath": data_dir,
|
| 218 |
+
"split": "train",
|
| 219 |
+
},
|
| 220 |
+
),
|
| 221 |
+
]
|
| 222 |
+
|
| 223 |
+
def _generate_examples(self, folderpath, split):
|
| 224 |
+
""" Yields examples. """
|
| 225 |
+
import ipdb; ipdb.set_trace()
|
| 226 |
+
|
| 227 |
+
files = os.listdir(folderpath)
|
| 228 |
+
|
| 229 |
+
if self.config == "first_part":
|
| 230 |
+
files = os.path.join(folderpath, files[0])
|
| 231 |
+
else:
|
| 232 |
+
files = [os.path.join(folderpath, file) for file in files]
|
| 233 |
+
|
| 234 |
+
for filepath in files:
|
| 235 |
+
with gzip.open(filepath, 'rt', encoding="utf-8") as f:
|
| 236 |
+
for id_, row in enumerate(f):
|
| 237 |
+
data = eval(row)
|
| 238 |
+
if self.config.name == "data_only":
|
| 239 |
+
yield id_, {
|
| 240 |
+
"raw_content": data["raw_content"],
|
| 241 |
+
}
|
| 242 |
+
else:
|
| 243 |
+
yield id_, data
|