diff --git a/2021_21/dedup/oscar-000000000001.json.gz b/2021_21/dedup/oscar-000000000001.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..d2f06df8511caa438648c1b0970d477e41fcc26b --- /dev/null +++ b/2021_21/dedup/oscar-000000000001.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1b28acfb5d654febc3fa9b7aa3632e1313b56e98292f43168100aed5a4ec815 +size 127341221 diff --git a/2021_21/dedup/oscar-000000000002.json.gz b/2021_21/dedup/oscar-000000000002.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..f58b46a5bc1a440c0edf49650359e8f45cde449b --- /dev/null +++ b/2021_21/dedup/oscar-000000000002.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db88067e0690d3d9f5739b7320385d5998463dc038505494c518341a8abb4937 +size 114794554 diff --git a/2021_21/dedup/oscar-000000000003.json.gz b/2021_21/dedup/oscar-000000000003.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..f257fed75b16b0f8d70c7abc520b9b37ae9a13e1 --- /dev/null +++ b/2021_21/dedup/oscar-000000000003.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9efd645bea40ca26fca065b6c3faf2a66bbf36e78b27a3481d4b4805088da2c7 +size 125905990 diff --git a/2021_21/dedup/oscar-000000000004.json.gz b/2021_21/dedup/oscar-000000000004.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..f11225f42b1aa48c3dba7cfaf7ffb70b2c85b749 --- /dev/null +++ b/2021_21/dedup/oscar-000000000004.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2961eab52a29516d3a409583dfe25bd369c59ec7cc412d07f4e297f16ba52b97 +size 123673801 diff --git a/2021_21/dedup/oscar-000000000005.json.gz b/2021_21/dedup/oscar-000000000005.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..c09298a282c91a85b4da5d1dc81df1fb9071af3b --- /dev/null +++ b/2021_21/dedup/oscar-000000000005.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b49877a6cdc55892c1787e43b0d231abe78e31aba546c82603e8a5161d26c6c0 +size 121963107 diff --git a/2021_21/dedup/oscar-000000000006.json.gz b/2021_21/dedup/oscar-000000000006.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..5beb697db4d7eecd42a7624cff5163c70d52ba39 --- /dev/null +++ b/2021_21/dedup/oscar-000000000006.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:975a0391414b7ddc3066775cad212e8e344e75ba19b4c102ed57d72f3c103d22 +size 123823194 diff --git a/2021_21/dedup/oscar-000000000007.json.gz b/2021_21/dedup/oscar-000000000007.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..c6bc57608ce242494d8f95619a61eae28b598b22 --- /dev/null +++ b/2021_21/dedup/oscar-000000000007.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2c92182adc34ad1aebc6b86ecefaf62ed5bdd267ea342e2e9b371f5938e9846 +size 115846564 diff --git a/2021_21/dedup/oscar-000000000008.json.gz b/2021_21/dedup/oscar-000000000008.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..49f0cecb16a6d7da75f9735dd7c48078d5fbd847 --- /dev/null +++ b/2021_21/dedup/oscar-000000000008.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8bd38ee40eaee9f8a47874218fc840f522887c3899d8db6d232acf84b6db8305 +size 129385817 diff --git a/2021_21/dedup/oscar-000000000009.json.gz b/2021_21/dedup/oscar-000000000009.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..9a06aadbe10d3a73e3db3eeaed1e6971e0f74a4b --- /dev/null +++ b/2021_21/dedup/oscar-000000000009.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4ba25334ca711a9b389546c8ec8fb7fd0656e28f7b553ebc3335fd22fb6a480 +size 139806875 diff --git a/2021_21/dedup/oscar-000000000010.json.gz b/2021_21/dedup/oscar-000000000010.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..8304fd9b97ee1cced18ad3ab99c0e8a070bdd115 --- /dev/null +++ b/2021_21/dedup/oscar-000000000010.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17b6f287d9be77a2c04635f821a97749e15b75e5176d2436f6833148a129c819 +size 128359767 diff --git a/2021_21/dedup/oscar-000000000011.json.gz b/2021_21/dedup/oscar-000000000011.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..94def61fb4fa47aa93f24ec6303b3e664baddd3b --- /dev/null +++ b/2021_21/dedup/oscar-000000000011.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fcf062ef4f7a7f4b49109bc77d77c4c4de73d10fe471f370a280fee91919e3f +size 140066887 diff --git a/2021_21/dedup/oscar-000000000012.json.gz b/2021_21/dedup/oscar-000000000012.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..a2eff6d73c0b33455c506047bf235ee9fb913576 --- /dev/null +++ b/2021_21/dedup/oscar-000000000012.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a446a7dcf13afa82a747fa8c7955cd2e811e307a7e44e53a3cee4e9f909f163 +size 117413142 diff --git a/2021_21/dedup/oscar-000000000013.json.gz b/2021_21/dedup/oscar-000000000013.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..234b748d7a1f7e17603b249de881c51d45587af7 --- /dev/null +++ b/2021_21/dedup/oscar-000000000013.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1d899a93a5993c67b799c92a9a68fe7a86b660686576f43d9496034f0651d59 +size 120692690 diff --git a/2021_21/dedup/oscar-000000000014.json.gz b/2021_21/dedup/oscar-000000000014.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..1235284691d159c5d29746521d0b987430658b42 --- /dev/null +++ b/2021_21/dedup/oscar-000000000014.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47c0fe02d7aab14990b8242730ecb018df0c3fc3e9bd2a0fecce063f81cf5b1d +size 125459849 diff --git a/2021_21/dedup/oscar-000000000015.json.gz b/2021_21/dedup/oscar-000000000015.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..617b0584398cc9cc690873a69687a761f753b0f7 --- /dev/null +++ b/2021_21/dedup/oscar-000000000015.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ece2a8be708645743ca4fd06101f7c5efaf201257de8945641cbf08949397c4f +size 128480395 diff --git a/2021_21/dedup/oscar-000000000016.json.gz b/2021_21/dedup/oscar-000000000016.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..d3f679e11d39dda1bb25dc451943dcf6441b5107 --- /dev/null +++ b/2021_21/dedup/oscar-000000000016.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c59d727da89a2f2d39b17cf28c12bd7e7be95d6440c15526db2519d27486dd4c +size 137127716 diff --git a/2021_21/dedup/oscar-000000000017.json.gz b/2021_21/dedup/oscar-000000000017.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..6f259e58516550c4d5cb6d59d50a4be50bbe50dc --- /dev/null +++ b/2021_21/dedup/oscar-000000000017.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aab2071283eb23a9a1273b1bb698bc1bf49ae95296663c5448f47900b5e29c39 +size 146653895 diff --git a/2021_21/dedup/oscar-000000000018.json.gz b/2021_21/dedup/oscar-000000000018.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..9ad9cda9a288e092ad32e1f5ba1e40a375dace35 --- /dev/null +++ b/2021_21/dedup/oscar-000000000018.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a977b9da02f427f24332112d3fc7873efc74e3130c80618cb3a7c9d8bc3f81e +size 139309680 diff --git a/2021_21/dedup/oscar-000000000019.json.gz b/2021_21/dedup/oscar-000000000019.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..c95fa070480da64b1690e95bd4853346b556c2d9 --- /dev/null +++ b/2021_21/dedup/oscar-000000000019.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfb6233bc64e3e4ad0bd4a08acf210f0888870f797e6bad6f13c351afae93886 +size 126546858 diff --git a/2021_21/dedup/oscar-000000000020.json.gz b/2021_21/dedup/oscar-000000000020.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..5f79956000b07f0d539fd915cabeba9082582d0e --- /dev/null +++ b/2021_21/dedup/oscar-000000000020.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4a7a59578d42dcb475fd38592ef3073cdc2b98daabdc71bea67df179787e69d +size 129634397 diff --git a/2021_21/dedup/oscar-000000000021.json.gz b/2021_21/dedup/oscar-000000000021.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..eebed8b051bdb056761a8c3b028cfd61e49744eb --- /dev/null +++ b/2021_21/dedup/oscar-000000000021.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abe2a0448024172f04b1e53774c9aca192612773af2b3471b4afdba2b801f4f9 +size 127733153 diff --git a/2021_21/dedup/oscar-000000000022.json.gz b/2021_21/dedup/oscar-000000000022.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..89571cf1285e3d67464466832066486ee02d586f --- /dev/null +++ b/2021_21/dedup/oscar-000000000022.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:838a07a941079297c5f23f1844ff920ed426fcd24edb8515151d4771ddb1f021 +size 130805886 diff --git a/2021_21/dedup/oscar-000000000023.json.gz b/2021_21/dedup/oscar-000000000023.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..7206ca5ae5d0a9c545895e6b1e73551e6a484be2 --- /dev/null +++ b/2021_21/dedup/oscar-000000000023.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f01327d095071ff57c04d32f4de6c1b0ea6394c9e2927aee3be808f09e9d86a +size 134503973 diff --git a/2021_21/dedup/oscar-000000000024.json.gz b/2021_21/dedup/oscar-000000000024.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..e283699a572cf313a20a5f0a4b97291326ef78d6 --- /dev/null +++ b/2021_21/dedup/oscar-000000000024.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d36ea0bd40b6767f9a0226b33da35308b57b960fd2c387464ef0e3a3f31da289 +size 124606151 diff --git a/2021_21/dedup/oscar-000000000025.json.gz b/2021_21/dedup/oscar-000000000025.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..60bcbb134fcb584b28043b9791506ab4c3fd0790 --- /dev/null +++ b/2021_21/dedup/oscar-000000000025.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4b6bbdeb30b659f645be1727b4953cf08501ad9b8cf1db261b063e353dae0e7 +size 130865974 diff --git a/2021_21/dedup/oscar-000000000026.json.gz b/2021_21/dedup/oscar-000000000026.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..6ef1a4de1a5a024d14c8f60367d4344b35076b02 --- /dev/null +++ b/2021_21/dedup/oscar-000000000026.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df05b0dbcb9098325acfde40c62b6192a93a8442edab4c2b6e9936de606a844a +size 144162173 diff --git a/2021_21/dedup/oscar-000000000027.json.gz b/2021_21/dedup/oscar-000000000027.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..1c68321a73abab8bd1a49da2664cb6d88831cfcf --- /dev/null +++ b/2021_21/dedup/oscar-000000000027.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ff47653243f1ba57c6fe669a2a018f168ba10da4ced0a0afd1c2bdb29477ad2 +size 139872728 diff --git a/2021_21/dedup/oscar-000000000028.json.gz b/2021_21/dedup/oscar-000000000028.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..587bf7eb3340c1fa3dcb9f6e9dd3bc0a955512b8 --- /dev/null +++ b/2021_21/dedup/oscar-000000000028.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a1255ea43326716412200f7d2b0245859641e00b7a88189f5f4782c330f5edd +size 132495352 diff --git a/2021_21/dedup/oscar-000000000029.json.gz b/2021_21/dedup/oscar-000000000029.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..f0c398adc52fcec9e9314a63bb2c7c27b1733da7 --- /dev/null +++ b/2021_21/dedup/oscar-000000000029.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf6518da32e5d2f607c6eb67266195bdc0cf8ac6cb37e1d6b37951d2c4569dd8 +size 132911426 diff --git a/2021_21/dedup/oscar-000000000030.json.gz b/2021_21/dedup/oscar-000000000030.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..0a91707c7caba056e4d17590226f173ce8b38f4b --- /dev/null +++ b/2021_21/dedup/oscar-000000000030.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5b7eab138a9e4ab25a7ae83cd116d1af306cf9113da96d6d83fc912a745e2ea +size 144193824 diff --git a/2021_21/dedup/oscar-000000000031.json.gz b/2021_21/dedup/oscar-000000000031.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..c2165643a05335a6c62e146fb4989e7de0f4583b --- /dev/null +++ b/2021_21/dedup/oscar-000000000031.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc1bc59c605ea69c47fad86ad2b0e66211786c50bb82701c116388475fd3c3f1 +size 146772212 diff --git a/2021_21/dedup/oscar-000000000032.json.gz b/2021_21/dedup/oscar-000000000032.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..0cc53f95ecf1a423e67139c7d64cf40b4cd95f47 --- /dev/null +++ b/2021_21/dedup/oscar-000000000032.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9050dde3ca70a275ddaa65b4273dd1aa8f0e2c2e2e0687daa7b98d884a50302f +size 142083208 diff --git a/2021_21/dedup/oscar-000000000033.json.gz b/2021_21/dedup/oscar-000000000033.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..7e6ac3eb23ed15681b6f16e406b0984e9cf03119 --- /dev/null +++ b/2021_21/dedup/oscar-000000000033.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e686a029d028e11db4725cbe5d040822e79f8c30ace90cc5c04ddcf52958123 +size 139509825 diff --git a/2021_21/dedup/oscar-000000000034.json.gz b/2021_21/dedup/oscar-000000000034.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..ab252725276ac3703e217d44e6d46b8561255368 --- /dev/null +++ b/2021_21/dedup/oscar-000000000034.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:490acbe46d4a6cf4e7fedd4ca4a73ee899b30d7b3eb96b06ffdccfd66fc39d7f +size 141932575 diff --git a/2021_21/dedup/oscar-000000000035.json.gz b/2021_21/dedup/oscar-000000000035.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..6a0b27cd654d77e95250e3efe132969aa0ab9756 --- /dev/null +++ b/2021_21/dedup/oscar-000000000035.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8ed8dde3d6b6b415f9da6826705850245d0429e247718b2f7b6ddb7b02e2938 +size 137458511 diff --git a/2021_21/dedup/oscar-000000000036.json.gz b/2021_21/dedup/oscar-000000000036.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..eae62d5aeb0e96160910f26222d84ac51b67819a --- /dev/null +++ b/2021_21/dedup/oscar-000000000036.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64f49a127fe39111042571e35b13f76cdb28d297f438d2228843b41b65c9d8fd +size 127091100 diff --git a/2021_21/dedup/oscar-000000000037.json.gz b/2021_21/dedup/oscar-000000000037.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..32402a3dd88953ff4423bbdb75da79a52b7b8d9e --- /dev/null +++ b/2021_21/dedup/oscar-000000000037.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdb1dc5806a3cadf0d3e120b30ae8c7803806a1414b54442426fbeeccead84dc +size 72094750 diff --git a/2021_21/dedup/oscar_2021_21_dedup.py b/2021_21/dedup/oscar_2021_21_dedup.py new file mode 100644 index 0000000000000000000000000000000000000000..fc597aaa4e4777ca338ff82465f0e68013c514e3 --- /dev/null +++ b/2021_21/dedup/oscar_2021_21_dedup.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Cleaned Indonesian split of the mC4 corpus.""" +import json +import glob +import gzip +import textwrap +import datasets +logger = datasets.logging.get_logger(__name__) + +file = sorted(glob.glob('/data/oscar_2021_21_dedup/data/*')) +_CITATION = """ +@article{JMLR:v21:20-074, + author = {Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu}, + title = {Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer}, + journal = {Journal of Machine Learning Research}, + year = {2020}, + volume = {21}, + number = {140}, + pages = {1-67}, + url = {http://jmlr.org/papers/v21/20-074.html} +} +""" +_DESCRIPTION = """\ +A thoroughly cleaned version of the Italian portion of the multilingual +colossal, cleaned version of Common Crawl's web crawl corpus (mC4) by AllenAI. +Based on Common Crawl dataset: "https://commoncrawl.org". +This is the processed version of Google's mC4 dataset by AllenAI, with further cleaning +detailed in the repository README file. +""" +_HOMEPAGE = "https://github.com/allenai/allennlp/discussions/5056" +_LICENSE = "Open Data Commons Attribution License (ODC-By) v1.0" +_BASE_URL = "https://huggingface.co/datasets/munggok/mc4-id/resolve/main/mc4-id-filter/c4-id{split_suffix}.tfrecord-{index:05d}-of-{n_shards:05d}.json.gz" +_CONFIGS = { + "tiny": {"train": 100, "validation": 1}, + "small": {"train": 250, "validation": 2}, + "medium": {"train": 500, "validation": 4}, + "large": {"train": 750, "validation": 6}, + "full": {"train": 1016, "validation": 8} +} +class OscarConfig(datasets.BuilderConfig): + """BuilderConfig for the Clean mC4 Italian.""" + def __init__(self, **kwargs): + """BuilderConfig for Clean mC4 Italian. + Args: + **kwargs: keyword arguments forwarded to super. + """ + super().__init__(**kwargs) +class Oscar(datasets.GeneratorBasedBuilder): + """mC4, a colossal, cleaned version of Common Crawl's web crawl corpus.""" + BUILDER_CONFIGS = [ + OscarConfig( + name="full", + version=datasets.Version("1.0.0"), + description=textwrap.dedent( + f"""\ + The full cleaned version of the Italian portion of the multilingual C4 corpus. + Estimated size of compressed files: 103GB + """ + ) + ) + ] + def _info(self): + return datasets.DatasetInfo( + description=_DESCRIPTION, + features=datasets.Features( + { + "text": datasets.Value("string"), + "url": datasets.Value("string"), + "timestamp": datasets.Value("string"), + "meta": datasets.Value("string"), + } + ), + supervised_keys=None, + homepage=_HOMEPAGE, + license=_LICENSE, + citation=_CITATION, + ) + def _split_generators(self, dl_manager): + data_urls = {} + train_downloaded_files = file + return [ + datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": train_downloaded_files}), + ] + def _generate_examples(self, filepaths): + """This function returns the examples in the raw (text) form by iterating on all the files.""" + id_ = 0 + for filepath in filepaths: + logger.info(f"Generating examples from {filepath}") + with gzip.open(open(filepath, "rb"), "rt", encoding="utf-8") as f: + for line in f: + if line: + example = json.loads(line) + yield id_, {'text':example['text'],'url':example['url'],'timestamp':example['timestamp'],'meta': example['meta']} + id_ += 1 diff --git a/2021_21/neardup/neardup_clean.py b/2021_21/neardup/neardup_clean.py new file mode 100644 index 0000000000000000000000000000000000000000..4b52186fb2345d748d5fbf345dbd41f257c7f480 --- /dev/null +++ b/2021_21/neardup/neardup_clean.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Cleaned Indonesian split of the mC4 corpus.""" +import json +import glob +import gzip +import textwrap +import datasets +logger = datasets.logging.get_logger(__name__) + +file = sorted(glob.glob('/data/oscar_id/2021_21/neardup/*.gz')) +_CITATION = """ +@article{JMLR:v21:20-074, + author = {Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu}, + title = {Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer}, + journal = {Journal of Machine Learning Research}, + year = {2020}, + volume = {21}, + number = {140}, + pages = {1-67}, + url = {http://jmlr.org/papers/v21/20-074.html} +} +""" +_DESCRIPTION = """\ +A thoroughly cleaned version of the Italian portion of the multilingual +colossal, cleaned version of Common Crawl's web crawl corpus (mC4) by AllenAI. +Based on Common Crawl dataset: "https://commoncrawl.org". +This is the processed version of Google's mC4 dataset by AllenAI, with further cleaning +detailed in the repository README file. +""" +_HOMEPAGE = "https://github.com/allenai/allennlp/discussions/5056" +_LICENSE = "Open Data Commons Attribution License (ODC-By) v1.0" +_BASE_URL = "https://huggingface.co/datasets/munggok/mc4-id/resolve/main/mc4-id-filter/c4-id{split_suffix}.tfrecord-{index:05d}-of-{n_shards:05d}.json.gz" +_CONFIGS = { + "tiny": {"train": 100, "validation": 1}, + "small": {"train": 250, "validation": 2}, + "medium": {"train": 500, "validation": 4}, + "large": {"train": 750, "validation": 6}, + "full": {"train": 1016, "validation": 8} +} +class OscarConfig(datasets.BuilderConfig): + """BuilderConfig for the Clean mC4 Italian.""" + def __init__(self, **kwargs): + """BuilderConfig for Clean mC4 Italian. + Args: + **kwargs: keyword arguments forwarded to super. + """ + super().__init__(**kwargs) +class Oscar(datasets.GeneratorBasedBuilder): + """mC4, a colossal, cleaned version of Common Crawl's web crawl corpus.""" + BUILDER_CONFIGS = [ + OscarConfig( + name="full", + version=datasets.Version("1.0.0"), + description=textwrap.dedent( + f"""\ + The full cleaned version of the Italian portion of the multilingual C4 corpus. + Estimated size of compressed files: 103GB + """ + ) + ) + ] + def _info(self): + return datasets.DatasetInfo( + description=_DESCRIPTION, + features=datasets.Features( + { + "text": datasets.Value("string"), + "url": datasets.Value("string"), + "timestamp": datasets.Value("string"), + "meta": datasets.Value("string"), + } + ), + supervised_keys=None, + homepage=_HOMEPAGE, + license=_LICENSE, + citation=_CITATION, + ) + def _split_generators(self, dl_manager): + data_urls = {} + train_downloaded_files = file + return [ + datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": train_downloaded_files}), + ] + def _generate_examples(self, filepaths): + """This function returns the examples in the raw (text) form by iterating on all the files.""" + id_ = 0 + for filepath in filepaths: + logger.info(f"Generating examples from {filepath}") + with gzip.open(open(filepath, "rb"), "rt", encoding="utf-8") as f: + for line in f: + if line: + example = json.loads(line) + yield id_, {'text':example['text'],'url':example['url'],'timestamp':example['timestamp'],'meta': example['meta']} + id_ += 1 diff --git a/2021_21/neardup/oscar-neardup-000000000001.json.gz b/2021_21/neardup/oscar-neardup-000000000001.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..006033aa1e04c53a8a9a58a7da1220903ad92eda --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000001.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12aca138a0c6f76a5d3c4a673ad317704598ba10baa9b61dc6276147f36847ce +size 126507303 diff --git a/2021_21/neardup/oscar-neardup-000000000002.json.gz b/2021_21/neardup/oscar-neardup-000000000002.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..a43773d30f540b709307afd024b7bc7c01212c7f --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000002.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9504c1ea60a2bb67f3431083c7387d27ee62b5fa234aa7f3a96c333e125c52b9 +size 116921271 diff --git a/2021_21/neardup/oscar-neardup-000000000003.json.gz b/2021_21/neardup/oscar-neardup-000000000003.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..078186daed071c10d001a31ced51903ca09969f1 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000003.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4150058257f8630d4a75fd1bf8e5dd6dba6db950e576c40970ffe6ae79e4489c +size 127888528 diff --git a/2021_21/neardup/oscar-neardup-000000000004.json.gz b/2021_21/neardup/oscar-neardup-000000000004.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..7213269639f36c077cfd3e1a993cb76dbff488c9 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000004.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e4e4e45b17c9b7652dbae65ba1454e59432db66bd864fa3ece212c080b49df3 +size 118308580 diff --git a/2021_21/neardup/oscar-neardup-000000000005.json.gz b/2021_21/neardup/oscar-neardup-000000000005.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..3afd56fe1d465588eced364e94f96246636c3598 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000005.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d44d9efe3cad48090c17a9a1ef766f4c32da85dcb4b2f359c2a362170bf9810 +size 126388537 diff --git a/2021_21/neardup/oscar-neardup-000000000006.json.gz b/2021_21/neardup/oscar-neardup-000000000006.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..b99ddd22098d95cdeab80fd2f50b8782003454ed --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000006.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b2f33de47b4dccaa5121426195db179996fa7e1c90222e462f5ea8447721c7b +size 116098988 diff --git a/2021_21/neardup/oscar-neardup-000000000007.json.gz b/2021_21/neardup/oscar-neardup-000000000007.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..131f08d0ec4188f40831b3b24d005a7f0399e288 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000007.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4577e998d9072f5e909fc390edb56b24be001f8844982498e4576aff7b7252d6 +size 130372693 diff --git a/2021_21/neardup/oscar-neardup-000000000008.json.gz b/2021_21/neardup/oscar-neardup-000000000008.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..f96f2d0c176108e7ab5422375bdbf3aed51733d9 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000008.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e86ab14e3cbb212972023917e21e8824013afded874f698ec0e6fac62b448b0 +size 137529281 diff --git a/2021_21/neardup/oscar-neardup-000000000009.json.gz b/2021_21/neardup/oscar-neardup-000000000009.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..8cc7b471513056064b7a000ea9bec983f9d2a945 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000009.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66673dbba3fcaea94d43a2628a5a781c47ae3346c0004e406f1977116b6bbece +size 133411496 diff --git a/2021_21/neardup/oscar-neardup-000000000010.json.gz b/2021_21/neardup/oscar-neardup-000000000010.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..ce604766abcb51669801f885c8671ff34b3bcb9d --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000010.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c034dfd11e8086a63384e2ce62fdf9f53f6a484c6ed9ec17164b12e0eae5cab1 +size 129863712 diff --git a/2021_21/neardup/oscar-neardup-000000000011.json.gz b/2021_21/neardup/oscar-neardup-000000000011.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..a6c12a15148bf3aa9ad0c072e5b424d2e4fc440c --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000011.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca563775ccdd75927644d970dc3c1dfdbbefe1b46aa4b31f2c00b80b428dea1f +size 118943987 diff --git a/2021_21/neardup/oscar-neardup-000000000012.json.gz b/2021_21/neardup/oscar-neardup-000000000012.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..aa69083f00bf82c4dba6566e2c082a84aef5fe8c --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000012.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7d535231004fa5d4ee3410d7ae589a384b2d00ad3aac0e50b7c6b8528f499b8 +size 124668626 diff --git a/2021_21/neardup/oscar-neardup-000000000013.json.gz b/2021_21/neardup/oscar-neardup-000000000013.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..1c5ace57015479743c12ad016bd2cf82b099ed09 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000013.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94ecb271f6fc182e280c0e56d84abad7cedecb35424b6d04461efffbd79dd383 +size 125364085 diff --git a/2021_21/neardup/oscar-neardup-000000000014.json.gz b/2021_21/neardup/oscar-neardup-000000000014.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..8571edffbbe9ea47e22c9d69fbefc6fe2ef9b255 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000014.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebfaf2b2e93e6f69ae8f8cef23f8317105b7536127f3a1190719cfafc159e87f +size 138468667 diff --git a/2021_21/neardup/oscar-neardup-000000000015.json.gz b/2021_21/neardup/oscar-neardup-000000000015.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..4307ca5901b4839a75826a3165c6468a0f9e9ed4 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000015.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79d95ce55eb2bf201b3694766aa2692e41cd1a1c4504de6ab758dd33c0fd0201 +size 144924318 diff --git a/2021_21/neardup/oscar-neardup-000000000016.json.gz b/2021_21/neardup/oscar-neardup-000000000016.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..308d9d8fd4e82e1b831a2aa0f820aa78d1953b2d --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000016.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe31e79935ba4c5c2c6a3dfd17da06bef245f0fa7df36455562a2908b2b66391 +size 137380558 diff --git a/2021_21/neardup/oscar-neardup-000000000017.json.gz b/2021_21/neardup/oscar-neardup-000000000017.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..0091505520dceb67ab6d48fdb7469748b6979a03 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000017.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77a83e4655f6da8d874d143b3da5af727543c045127a04c5384d3ae4c80919fd +size 126494323 diff --git a/2021_21/neardup/oscar-neardup-000000000018.json.gz b/2021_21/neardup/oscar-neardup-000000000018.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..58f7a1ac247fb374d8f3e884b6a6230c3e6d5330 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000018.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4e43f8a6d8bcd3ff028e8ae56d152ffcb475af097f832aa3dcebb55a442e6f2 +size 128202594 diff --git a/2021_21/neardup/oscar-neardup-000000000019.json.gz b/2021_21/neardup/oscar-neardup-000000000019.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..28422f745753492c400f02f76edda18ac3bd748b --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000019.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fa7943e09915810f3a58e76389b4b3f43004e5e4ff6c30402d9b46f6b38e01b +size 130704237 diff --git a/2021_21/neardup/oscar-neardup-000000000020.json.gz b/2021_21/neardup/oscar-neardup-000000000020.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..39f185a13138ec8544435a4bff52b6b1a3ba5270 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000020.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd7b5788b736ca8724b5debbed6827a45113e0bc7cc95882a7c5189b2d7a22c6 +size 135372951 diff --git a/2021_21/neardup/oscar-neardup-000000000021.json.gz b/2021_21/neardup/oscar-neardup-000000000021.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..cdf8c2fd20adc94c71f734fb9142ad5b174a20e2 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000021.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5803410b111591523b980822891f6ed6405ebdb3864d3337bc5181cf2198b069 +size 125873035 diff --git a/2021_21/neardup/oscar-neardup-000000000022.json.gz b/2021_21/neardup/oscar-neardup-000000000022.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..2ea2c73a222ad663a7454abc544ac37fb3d35d59 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000022.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef5b482a54b3392c49957d1019141abfdd137844f5da0978f4219ada6d78eb77 +size 135300016 diff --git a/2021_21/neardup/oscar-neardup-000000000023.json.gz b/2021_21/neardup/oscar-neardup-000000000023.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..866882cb711c1f4e458da67db0116126151550c3 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000023.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:894863d9bc9b24caddbe16b6323389282687969721cf7a2e306666c701f93a82 +size 138975073 diff --git a/2021_21/neardup/oscar-neardup-000000000024.json.gz b/2021_21/neardup/oscar-neardup-000000000024.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..54e7a423018fb36fb8a41967a60543c49357ed30 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000024.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:784fe35b9407a45924805e92e960b1c6efc15fa324f0d5d753955ebb1485f6af +size 142899064 diff --git a/2021_21/neardup/oscar-neardup-000000000025.json.gz b/2021_21/neardup/oscar-neardup-000000000025.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..0f2eb50224d0a9875345c2da096c303bfb1e02ce --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000025.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03b2ee44d3f35a7d41c8f4e2bdd0d367e71a04082b5040446e710cd78be11d0b +size 126753447 diff --git a/2021_21/neardup/oscar-neardup-000000000026.json.gz b/2021_21/neardup/oscar-neardup-000000000026.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..4d465560c9b75508f9f44e380cb2944bc19c4fd5 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000026.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05c8d6ae7a3f2d3e92e0edf34fcd09289b50d9528f5d00bedc488d7e8b923873 +size 144654120 diff --git a/2021_21/neardup/oscar-neardup-000000000027.json.gz b/2021_21/neardup/oscar-neardup-000000000027.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..71a0c350572864f26aa9de4621a8560774215709 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000027.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a987de98091c84ee4ad956b04d5c078d7087c4121f949de8e1f6d946af5a97c2 +size 143931518 diff --git a/2021_21/neardup/oscar-neardup-000000000028.json.gz b/2021_21/neardup/oscar-neardup-000000000028.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..07e3c61307bf7dff7ea5cf445f3bc413f6556327 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000028.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6301445f02e594a4ccc9422b34a940ec079001a34da49b4729f4797076e8ff5a +size 141970578 diff --git a/2021_21/neardup/oscar-neardup-000000000029.json.gz b/2021_21/neardup/oscar-neardup-000000000029.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..70e62e9caa4cba24d5cf3d4754f84b8167459dc0 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000029.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd87cf4ddfd8b1cc0736aa6afe6caaadc1ef917bf5a4268a76a0c1c90e07f205 +size 140437047 diff --git a/2021_21/neardup/oscar-neardup-000000000030.json.gz b/2021_21/neardup/oscar-neardup-000000000030.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..3c567e73c400d1e9ec6d9d029cf3cbdfd82c39af --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000030.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f68376e1bec1b127afdaf57557bdcf5803c27287bd94fa868d8321358eea6fcd +size 140257255 diff --git a/2021_21/neardup/oscar-neardup-000000000031.json.gz b/2021_21/neardup/oscar-neardup-000000000031.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..3e4b914953ed83e694a50d48b10f876572d84614 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000031.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4032a0ee042b994974fa54ea71e51bbff1550c555ea07eeb1a94ed9f2282a49d +size 138492408 diff --git a/2021_21/neardup/oscar-neardup-000000000032.json.gz b/2021_21/neardup/oscar-neardup-000000000032.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..52be81ba697bffb260ad4a6bef75fae93242c0af --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000032.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3aaf235f6abae312d4d2b0e5f4efd1acd51b1042293474f70c9c6d34b735f84f +size 121509515 diff --git a/2021_21/neardup/oscar-neardup-000000000033.json.gz b/2021_21/neardup/oscar-neardup-000000000033.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..baf24d1fbbb2a6acd30dca059770c396052dc033 --- /dev/null +++ b/2021_21/neardup/oscar-neardup-000000000033.json.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df711d3c9bc181355ac2a589d78c0789f266f33b8dbde408a50613fa5e1c1888 +size 1862726 diff --git a/2021_21/raw/raw_2021-21.py b/2021_21/raw/raw_2021-21.py new file mode 100644 index 0000000000000000000000000000000000000000..f797400293af55cb7de467a83b04c3508a1a1cd6 --- /dev/null +++ b/2021_21/raw/raw_2021-21.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Cleaned Indonesian split of the mC4 corpus.""" +import json +import glob +import gzip +import textwrap +import zstandard as zstd +import datasets +logger = datasets.logging.get_logger(__name__) + +file = sorted(glob.glob('/data/oscar_2021_21_raw/*.zst')) +_CITATION = """ +@article{JMLR:v21:20-074, + author = {Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu}, + title = {Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer}, + journal = {Journal of Machine Learning Research}, + year = {2020}, + volume = {21}, + number = {140}, + pages = {1-67}, + url = {http://jmlr.org/papers/v21/20-074.html} +} +""" +_DESCRIPTION = """\ +A thoroughly cleaned version of the Italian portion of the multilingual +colossal, cleaned version of Common Crawl's web crawl corpus (mC4) by AllenAI. +Based on Common Crawl dataset: "https://commoncrawl.org". +This is the processed version of Google's mC4 dataset by AllenAI, with further cleaning +detailed in the repository README file. +""" +_HOMEPAGE = "https://github.com/allenai/allennlp/discussions/5056" +_LICENSE = "Open Data Commons Attribution License (ODC-By) v1.0" +_BASE_URL = "https://huggingface.co/datasets/munggok/mc4-id/resolve/main/mc4-id-filter/c4-id{split_suffix}.tfrecord-{index:05d}-of-{n_shards:05d}.json.gz" +_CONFIGS = { + "tiny": {"train": 100, "validation": 1}, + "small": {"train": 250, "validation": 2}, + "medium": {"train": 500, "validation": 4}, + "large": {"train": 750, "validation": 6}, + "full": {"train": 1016, "validation": 8} +} +class OscarConfig(datasets.BuilderConfig): + """BuilderConfig for the Clean mC4 Italian.""" + def __init__(self, **kwargs): + """BuilderConfig for Clean mC4 Italian. + Args: + **kwargs: keyword arguments forwarded to super. + """ + super().__init__(**kwargs) +class Oscar(datasets.GeneratorBasedBuilder): + """mC4, a colossal, cleaned version of Common Crawl's web crawl corpus.""" + BUILDER_CONFIGS = [ + OscarConfig( + name="full", + version=datasets.Version("1.0.0"), + description=textwrap.dedent( + f"""\ + The full cleaned version of the Italian portion of the multilingual C4 corpus. + Estimated size of compressed files: 103GB + """ + ) + ) + ] + def _info(self): + return datasets.DatasetInfo( + description=_DESCRIPTION, + features=datasets.Features( + { + "text": datasets.Value("string"), + "url": datasets.Value("string"), + "timestamp": datasets.Value("string"), + "meta": datasets.Value("string"), + } + ), + supervised_keys=None, + homepage=_HOMEPAGE, + license=_LICENSE, + citation=_CITATION, + ) + def _split_generators(self, dl_manager): + data_urls = {} + train_downloaded_files = file + return [ + datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepaths": train_downloaded_files}), + ] + def _generate_examples(self, filepaths): + """This function returns the examples in the raw (text) form by iterating on all the files.""" + id_ = 0 + for filepath in filepaths: + logger.info(f"Generating examples from {filepath}") + with zstd.open(open(filepath, "rb"), "rt", encoding="utf-8") as f: + for line in f: + if line: + example = json.loads(line) + meta = dict() + meta["warc_headers"] = example["warc_headers"] + meta["warc_headers"]["warc-identified-content-language"] = example[ + "warc_headers" + ].get("warc-identified-content-language") + meta["identification"] = example["metadata"]["identification"] + meta["annotations"] = example["metadata"]["annotation"] + meta["line_identifications"] = example["metadata"][ + "sentence_identifications" + ] + yield id_, {'text':example['content'],'url':example['warc_headers']['warc-target-uri'],'timestamp':example['warc_headers']['warc-date'],"meta": json.dumps(meta)} + id_ += 1