Datasets:
Formats:
parquet
Sub-tasks:
language-modeling
Languages:
English
Size:
10M - 100M
Tags:
text-search
License:
Convert dataset to Parquet
#4
by
albertvillanova
HF staff
- opened
This view is limited to 50 files because it contains too many changes.
See the raw diff here.
- README.md +16 -8
- wiki40b_en_100_0/train-00000-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00001-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00002-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00003-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00004-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00005-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00006-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00007-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00008-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00009-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00010-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00011-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00012-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00013-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00014-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00015-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00016-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00017-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00018-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00019-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00020-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00021-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00022-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00023-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00024-of-00026.parquet +3 -0
- wiki40b_en_100_0/train-00025-of-00026.parquet +3 -0
- wiki_snippets.py +0 -210
- wikipedia_en_100_0/train-00000-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00001-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00002-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00003-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00004-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00005-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00006-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00007-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00008-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00009-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00010-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00011-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00012-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00013-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00014-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00015-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00016-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00017-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00018-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00019-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00020-of-00053.parquet +3 -0
- wikipedia_en_100_0/train-00021-of-00053.parquet +3 -0
README.md
CHANGED
@@ -9,7 +9,6 @@ license:
|
|
9 |
- unknown
|
10 |
multilinguality:
|
11 |
- multilingual
|
12 |
-
pretty_name: WikiSnippets
|
13 |
size_categories:
|
14 |
- 10M<n<100M
|
15 |
source_datasets:
|
@@ -20,7 +19,7 @@ task_categories:
|
|
20 |
- other
|
21 |
task_ids:
|
22 |
- language-modeling
|
23 |
-
|
24 |
tags:
|
25 |
- text-search
|
26 |
dataset_info:
|
@@ -48,10 +47,10 @@ dataset_info:
|
|
48 |
dtype: string
|
49 |
splits:
|
50 |
- name: train
|
51 |
-
num_bytes:
|
52 |
num_examples: 17553713
|
53 |
-
download_size:
|
54 |
-
dataset_size:
|
55 |
- config_name: wikipedia_en_100_0
|
56 |
features:
|
57 |
- name: _id
|
@@ -76,10 +75,19 @@ dataset_info:
|
|
76 |
dtype: string
|
77 |
splits:
|
78 |
- name: train
|
79 |
-
num_bytes:
|
80 |
num_examples: 33849898
|
81 |
-
download_size:
|
82 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
---
|
84 |
|
85 |
# Dataset Card for "wiki_snippets"
|
|
|
9 |
- unknown
|
10 |
multilinguality:
|
11 |
- multilingual
|
|
|
12 |
size_categories:
|
13 |
- 10M<n<100M
|
14 |
source_datasets:
|
|
|
19 |
- other
|
20 |
task_ids:
|
21 |
- language-modeling
|
22 |
+
pretty_name: WikiSnippets
|
23 |
tags:
|
24 |
- text-search
|
25 |
dataset_info:
|
|
|
47 |
dtype: string
|
48 |
splits:
|
49 |
- name: train
|
50 |
+
num_bytes: 12927635491
|
51 |
num_examples: 17553713
|
52 |
+
download_size: 7022389836
|
53 |
+
dataset_size: 12927635491
|
54 |
- config_name: wikipedia_en_100_0
|
55 |
features:
|
56 |
- name: _id
|
|
|
75 |
dtype: string
|
76 |
splits:
|
77 |
- name: train
|
78 |
+
num_bytes: 26386660503
|
79 |
num_examples: 33849898
|
80 |
+
download_size: 13135892980
|
81 |
+
dataset_size: 26386660503
|
82 |
+
configs:
|
83 |
+
- config_name: wiki40b_en_100_0
|
84 |
+
data_files:
|
85 |
+
- split: train
|
86 |
+
path: wiki40b_en_100_0/train-*
|
87 |
+
- config_name: wikipedia_en_100_0
|
88 |
+
data_files:
|
89 |
+
- split: train
|
90 |
+
path: wikipedia_en_100_0/train-*
|
91 |
---
|
92 |
|
93 |
# Dataset Card for "wiki_snippets"
|
wiki40b_en_100_0/train-00000-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dbd0d797b13c595355033ac8da62b50af32af19c1a8b5f00c59effaf19959a9b
|
3 |
+
size 269809555
|
wiki40b_en_100_0/train-00001-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b80e169f3a93db11b70270c2031342f5e0d679c077d6d48d5ef03ff529c3ff22
|
3 |
+
size 270082078
|
wiki40b_en_100_0/train-00002-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:337e30fc0fe9d12f2fceb462079194ef0c6563fb919a9ab7af5f0da437ae35f3
|
3 |
+
size 269603677
|
wiki40b_en_100_0/train-00003-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5c62f521c67e1e78a287a6ca418294bb876cf99013df2b4d747c18452d6a5edf
|
3 |
+
size 269969493
|
wiki40b_en_100_0/train-00004-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:15b58086ea2b9a9be37264cfdab138041572113a5d66c7b9fe7414712c19fe00
|
3 |
+
size 270094047
|
wiki40b_en_100_0/train-00005-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:562af627e11b179422029c442b75818f61f48a1b28c9bf13edd6f803bd3f6a78
|
3 |
+
size 269779026
|
wiki40b_en_100_0/train-00006-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c1c187608050f9322962c4d7f4fd82846689b94362b0182a118360dfae8bcada
|
3 |
+
size 269999755
|
wiki40b_en_100_0/train-00007-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6e58f875231cee1b080cb3bec60ce157d562bda2b4d2c52e93294bf4a8769f05
|
3 |
+
size 269988401
|
wiki40b_en_100_0/train-00008-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e0b3d74f7c30fb2387fb3ad96beb42c8d3f94a7afdc95020072f2edce71dd40b
|
3 |
+
size 270024527
|
wiki40b_en_100_0/train-00009-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fe97808c40edbd78441b193c73b8b8240d2519fd102445ff820a520d38908160
|
3 |
+
size 270068079
|
wiki40b_en_100_0/train-00010-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f80d3b906b0ca1da49f1bf5eaad2cacd09b03d318a13243860badc2dd23a8fd8
|
3 |
+
size 270126067
|
wiki40b_en_100_0/train-00011-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:63472f483acfcaba8ab99ed39fbd60388d493f1b6592436fdd2ef5e5de6f1707
|
3 |
+
size 269867137
|
wiki40b_en_100_0/train-00012-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:79edd3e97f3051a365e9e4ca7b6c6c0aa404dd404484a5b9a08aa0a46734031a
|
3 |
+
size 269741445
|
wiki40b_en_100_0/train-00013-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f24349d55318eb94ac4e33cfa8922aa59df8ec1ce9a2d9c678863382a2a29217
|
3 |
+
size 270056313
|
wiki40b_en_100_0/train-00014-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ebc3c44de93cbe635b12b760acc85c16e2836bd557f8fe4199317ddecdd0fd4e
|
3 |
+
size 269951458
|
wiki40b_en_100_0/train-00015-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5066d6ad7ec3ef84f6b0b0bfdbd4def735916d88053a906e6b1555067d038b6a
|
3 |
+
size 269983165
|
wiki40b_en_100_0/train-00016-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:157609a844ff12a00355b4b34db50f4c9174332121a17a6b10f0807a98e8e43b
|
3 |
+
size 270095342
|
wiki40b_en_100_0/train-00017-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:60f49ea2ca9dd62b944100ebb879414db1026c4d8a29074489d5f5fbbaf62bc4
|
3 |
+
size 270098087
|
wiki40b_en_100_0/train-00018-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:54e015e82ec920558e236eebd4d44d5fe91a5ffd5adda06e83eeb92713eb36b4
|
3 |
+
size 270006338
|
wiki40b_en_100_0/train-00019-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d922d0dbbf35784eb3a4c5dd838c9592fcd046d543be54382ed595bace187cb5
|
3 |
+
size 270171711
|
wiki40b_en_100_0/train-00020-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0aed6229d479a21e2f86e2084687561525b09ab1742c7204668422cbaca12559
|
3 |
+
size 270095266
|
wiki40b_en_100_0/train-00021-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c62c4cb8e1d3d89ae65b020128958533136115eccfee9a9351d9d72315df44d9
|
3 |
+
size 269898983
|
wiki40b_en_100_0/train-00022-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:af629804ce09596e04c14c29f74ec27f9ada2d4bce7248633f6fa29745223108
|
3 |
+
size 270073310
|
wiki40b_en_100_0/train-00023-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a6a6dc6099d89c11ebe9841d66fbe296ccdbd175b2aad98c9c1097a46b953208
|
3 |
+
size 270762122
|
wiki40b_en_100_0/train-00024-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a7eea1fbbb95ed9c53c05331b49d41d085daf987b1dae05179c40a2cd1a22e1b
|
3 |
+
size 271101727
|
wiki40b_en_100_0/train-00025-of-00026.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:34e47e8acbe1ec1673584316049af6976e465ca096908fcd2afb2e75cdd1d396
|
3 |
+
size 270942727
|
wiki_snippets.py
DELETED
@@ -1,210 +0,0 @@
|
|
1 |
-
# WARNING: Please, do not use the code in this script as a template to create another script:
|
2 |
-
# - It is a bad practice to use `datasets.load_dataset` inside a loading script. Please, avoid doing it.
|
3 |
-
|
4 |
-
import json
|
5 |
-
import math
|
6 |
-
|
7 |
-
import datasets
|
8 |
-
|
9 |
-
|
10 |
-
logger = datasets.logging.get_logger(__name__)
|
11 |
-
|
12 |
-
|
13 |
-
_CITATION = """\
|
14 |
-
@ONLINE {wikidump,
|
15 |
-
author = {Wikimedia Foundation},
|
16 |
-
title = {Wikimedia Downloads},
|
17 |
-
url = {https://dumps.wikimedia.org}
|
18 |
-
}
|
19 |
-
"""
|
20 |
-
|
21 |
-
_DESCRIPTION = """\
|
22 |
-
Wikipedia version split into plain text snippets for dense semantic indexing.
|
23 |
-
"""
|
24 |
-
|
25 |
-
_LICENSE = (
|
26 |
-
"This work is licensed under the Creative Commons Attribution-ShareAlike "
|
27 |
-
"3.0 Unported License. To view a copy of this license, visit "
|
28 |
-
"http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to "
|
29 |
-
"Creative Commons, PO Box 1866, Mountain View, CA 94042, USA."
|
30 |
-
)
|
31 |
-
|
32 |
-
|
33 |
-
def wiki40b_article_snippets(article, passage_len=100, overlap=0):
|
34 |
-
paragraphs = article["text"].split("\n")
|
35 |
-
aticle_idx = paragraphs.index("_START_ARTICLE_") + 1
|
36 |
-
article_title = paragraphs[aticle_idx] if aticle_idx < len(paragraphs) else ""
|
37 |
-
section_indices = [i + 1 for i, par in enumerate(paragraphs[:-1]) if par == "_START_SECTION_"]
|
38 |
-
par_tabs = [par.split(" ") for par in paragraphs]
|
39 |
-
word_map = [
|
40 |
-
(i, len(" ".join(par[:j])), w)
|
41 |
-
for i, par in enumerate(par_tabs)
|
42 |
-
if not par[0].startswith("_START_")
|
43 |
-
for j, w in enumerate(par)
|
44 |
-
if i > 0
|
45 |
-
]
|
46 |
-
step_size = passage_len - overlap
|
47 |
-
passages = []
|
48 |
-
for i in range(math.ceil(len(word_map) / step_size)):
|
49 |
-
pre_toks = word_map[i * step_size : i * step_size + passage_len]
|
50 |
-
start_section_id = max([0] + [j for j in section_indices if j <= pre_toks[0][0]])
|
51 |
-
section_ids = [j for j in section_indices if j >= start_section_id and j <= pre_toks[-1][0]]
|
52 |
-
section_ids = section_ids if len(section_ids) > 0 else [0]
|
53 |
-
passage_text = " ".join([w for p_id, s_id, w in pre_toks])
|
54 |
-
passages += [
|
55 |
-
{
|
56 |
-
"article_title": article_title,
|
57 |
-
"section_title": " & ".join([paragraphs[j] for j in section_ids]),
|
58 |
-
"wiki_id": article["wikidata_id"],
|
59 |
-
"start_paragraph": pre_toks[0][0],
|
60 |
-
"start_character": pre_toks[0][1],
|
61 |
-
"end_paragraph": pre_toks[-1][0],
|
62 |
-
"end_character": pre_toks[-1][1] + len(pre_toks[-1][2]) + 1,
|
63 |
-
"passage_text": passage_text.replace("_NEWLINE_", "\n"),
|
64 |
-
}
|
65 |
-
]
|
66 |
-
return passages
|
67 |
-
|
68 |
-
|
69 |
-
def wikipedia_article_snippets(article, passage_len=100, overlap=0):
|
70 |
-
paragraphs = [par for par in article["text"].split("\n") if not par.startswith("Category:")]
|
71 |
-
if "References" in paragraphs:
|
72 |
-
paragraphs = paragraphs[: paragraphs.index("References")]
|
73 |
-
article_title = article["title"]
|
74 |
-
section_indices = [
|
75 |
-
i + 1
|
76 |
-
for i, par in enumerate(paragraphs[:-2])
|
77 |
-
if paragraphs[i] == "" and paragraphs[i + 1] != "" and paragraphs[i + 2] != ""
|
78 |
-
]
|
79 |
-
par_tabs = [par.split(" ") for par in paragraphs]
|
80 |
-
word_map = [(i, len(" ".join(par[:j])), w) for i, par in enumerate(par_tabs) for j, w in enumerate(par)]
|
81 |
-
step_size = passage_len - overlap
|
82 |
-
passages = []
|
83 |
-
for i in range(math.ceil(len(word_map) / step_size)):
|
84 |
-
pre_toks = word_map[i * step_size : i * step_size + passage_len]
|
85 |
-
start_section_id = max([0] + [j for j in section_indices if j <= pre_toks[0][0]])
|
86 |
-
section_ids = [j for j in section_indices if start_section_id <= j <= pre_toks[-1][0]]
|
87 |
-
section_ids = section_ids if len(section_ids) > 0 else [-1]
|
88 |
-
passage_text = " ".join([w for p_id, s_id, w in pre_toks])
|
89 |
-
passages += [
|
90 |
-
{
|
91 |
-
"article_title": article_title,
|
92 |
-
"section_title": " & ".join(["Start" if j == -1 else paragraphs[j].strip() for j in section_ids]),
|
93 |
-
"wiki_id": article_title.replace(" ", "_"),
|
94 |
-
"start_paragraph": pre_toks[0][0],
|
95 |
-
"start_character": pre_toks[0][1],
|
96 |
-
"end_paragraph": pre_toks[-1][0],
|
97 |
-
"end_character": pre_toks[-1][1] + len(pre_toks[-1][2]) + 1,
|
98 |
-
"passage_text": passage_text,
|
99 |
-
}
|
100 |
-
]
|
101 |
-
return passages
|
102 |
-
|
103 |
-
|
104 |
-
_SPLIT_FUNCTION_MAP = {
|
105 |
-
"wikipedia": wikipedia_article_snippets,
|
106 |
-
"wiki40b": wiki40b_article_snippets,
|
107 |
-
}
|
108 |
-
|
109 |
-
|
110 |
-
def generate_snippets(wikipedia, split_function, passage_len=100, overlap=0):
|
111 |
-
for i, article in enumerate(wikipedia):
|
112 |
-
for doc in split_function(article, passage_len, overlap):
|
113 |
-
part_id = json.dumps(
|
114 |
-
{
|
115 |
-
"datasets_id": i,
|
116 |
-
"wiki_id": doc["wiki_id"],
|
117 |
-
"sp": doc["start_paragraph"],
|
118 |
-
"sc": doc["start_character"],
|
119 |
-
"ep": doc["end_paragraph"],
|
120 |
-
"ec": doc["end_character"],
|
121 |
-
}
|
122 |
-
)
|
123 |
-
doc["_id"] = part_id
|
124 |
-
doc["datasets_id"] = i
|
125 |
-
yield doc
|
126 |
-
|
127 |
-
|
128 |
-
class WikiSnippetsConfig(datasets.BuilderConfig):
|
129 |
-
"""BuilderConfig for WikiSnippets."""
|
130 |
-
|
131 |
-
def __init__(
|
132 |
-
self, wikipedia_name="wiki40b", wikipedia_version_name="en", snippets_length=100, snippets_overlap=0, **kwargs
|
133 |
-
):
|
134 |
-
"""BuilderConfig for WikiSnippets.
|
135 |
-
Args:
|
136 |
-
**kwargs: keyword arguments forwarded to super.
|
137 |
-
"""
|
138 |
-
super(WikiSnippetsConfig, self).__init__(**kwargs)
|
139 |
-
self.wikipedia_name = wikipedia_name
|
140 |
-
self.wikipedia_version_name = wikipedia_version_name
|
141 |
-
self.snippets_length = snippets_length
|
142 |
-
self.snippets_overlap = snippets_overlap
|
143 |
-
|
144 |
-
|
145 |
-
class WikiSnippets(datasets.GeneratorBasedBuilder):
|
146 |
-
BUILDER_CONFIG_CLASS = WikiSnippetsConfig
|
147 |
-
BUILDER_CONFIGS = [
|
148 |
-
WikiSnippetsConfig(
|
149 |
-
name="wiki40b_en_100_0",
|
150 |
-
version=datasets.Version("1.0.0"),
|
151 |
-
wikipedia_name="wiki40b",
|
152 |
-
wikipedia_version_name="en",
|
153 |
-
snippets_length=100,
|
154 |
-
snippets_overlap=0,
|
155 |
-
),
|
156 |
-
WikiSnippetsConfig(
|
157 |
-
name="wikipedia_en_100_0",
|
158 |
-
version=datasets.Version("2.0.0"),
|
159 |
-
wikipedia_name="wikipedia",
|
160 |
-
wikipedia_version_name="20220301.en",
|
161 |
-
snippets_length=100,
|
162 |
-
snippets_overlap=0,
|
163 |
-
),
|
164 |
-
]
|
165 |
-
|
166 |
-
test_dummy_data = False
|
167 |
-
|
168 |
-
def _info(self):
|
169 |
-
return datasets.DatasetInfo(
|
170 |
-
description=_DESCRIPTION,
|
171 |
-
features=datasets.Features(
|
172 |
-
{
|
173 |
-
"_id": datasets.Value("string"),
|
174 |
-
"datasets_id": datasets.Value("int32"),
|
175 |
-
"wiki_id": datasets.Value("string"),
|
176 |
-
"start_paragraph": datasets.Value("int32"),
|
177 |
-
"start_character": datasets.Value("int32"),
|
178 |
-
"end_paragraph": datasets.Value("int32"),
|
179 |
-
"end_character": datasets.Value("int32"),
|
180 |
-
"article_title": datasets.Value("string"),
|
181 |
-
"section_title": datasets.Value("string"),
|
182 |
-
"passage_text": datasets.Value("string"),
|
183 |
-
}
|
184 |
-
),
|
185 |
-
supervised_keys=None,
|
186 |
-
homepage="https://dumps.wikimedia.org",
|
187 |
-
citation=_CITATION,
|
188 |
-
)
|
189 |
-
|
190 |
-
def _split_generators(self, dl_manager):
|
191 |
-
# WARNING: It is a bad practice to use `datasets.load_dataset` inside a loading script. Please, avoid doing it.
|
192 |
-
wikipedia = datasets.load_dataset(
|
193 |
-
path=self.config.wikipedia_name,
|
194 |
-
name=self.config.wikipedia_version_name,
|
195 |
-
)
|
196 |
-
|
197 |
-
return [
|
198 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"wikipedia": wikipedia}),
|
199 |
-
]
|
200 |
-
|
201 |
-
def _generate_examples(self, wikipedia):
|
202 |
-
logger.info(f"generating examples from = {self.config.wikipedia_name} {self.config.wikipedia_version_name}")
|
203 |
-
for split in wikipedia:
|
204 |
-
dset = wikipedia[split]
|
205 |
-
split_function = _SPLIT_FUNCTION_MAP[self.config.wikipedia_name]
|
206 |
-
for doc in generate_snippets(
|
207 |
-
dset, split_function, passage_len=self.config.snippets_length, overlap=self.config.snippets_overlap
|
208 |
-
):
|
209 |
-
id_ = doc["_id"]
|
210 |
-
yield id_, doc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wikipedia_en_100_0/train-00000-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0042535492136786245f587a3632f9e197019b0a079456756922685af182c9a7
|
3 |
+
size 264622407
|
wikipedia_en_100_0/train-00001-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:425d51eba211cb2bbb281f1a34d998c30921ac6123675d7efdf0331e15a17e47
|
3 |
+
size 260510417
|
wikipedia_en_100_0/train-00002-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:425b754555b82e3784984192e3ec021b431b43d79f54221105b5078a61fe77a8
|
3 |
+
size 233033093
|
wikipedia_en_100_0/train-00003-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:72f6b32fe5b8584e360022dba263672b0ad04ffb0eadc2ede15de86d171bed23
|
3 |
+
size 262116051
|
wikipedia_en_100_0/train-00004-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a95c3b6e12635ec309a70df68f50fbe51b6642d47552fd3b7b268c6440ee9b39
|
3 |
+
size 262444135
|
wikipedia_en_100_0/train-00005-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:52ce75f4f3bc3dc8c8964d1d49c16638629f5a31b2c4a4bd7b02d80c172e0177
|
3 |
+
size 259679089
|
wikipedia_en_100_0/train-00006-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:72b56445a8db75257d0407b8bddedd2adf65b4bf014c07adc4341a087634ca8d
|
3 |
+
size 254142600
|
wikipedia_en_100_0/train-00007-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:17d263c2f1046ab79b08da1947be684d6f26ba4bf0456227bc71e31cbc83a801
|
3 |
+
size 259540332
|
wikipedia_en_100_0/train-00008-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:81cebc5d50ae0d3936725fc4b22a2196a356b895688962ff4c5e9fdcad8f54ac
|
3 |
+
size 259122901
|
wikipedia_en_100_0/train-00009-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e9d279185dfaedde6b1cf69413d9c60c063a6495ef74cc4ca0646c6832736015
|
3 |
+
size 258046025
|
wikipedia_en_100_0/train-00010-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:be60382b2d11ff91bf3963631cf65dd2ee543c854143a0c59fa16cc543490216
|
3 |
+
size 258962391
|
wikipedia_en_100_0/train-00011-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1053b1734d3112415a312e9077ceee59d921be281bb8ea7c55f4cad8bdf75144
|
3 |
+
size 258473962
|
wikipedia_en_100_0/train-00012-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8f3288680451cf7b1f2a0b6a12fe2368bba4ee4b382bfdb7a9d39a98e07ede93
|
3 |
+
size 257085912
|
wikipedia_en_100_0/train-00013-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:09edfdf1cebd7e0ae0b7ec50ce848362f5466196fbc5ed451ccaeefc35663ccf
|
3 |
+
size 255874729
|
wikipedia_en_100_0/train-00014-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ccb189b314b61dccf27de88e4e0258c7d1c11219ab5a92220688b3750afc332
|
3 |
+
size 255289493
|
wikipedia_en_100_0/train-00015-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c272a3becc6e1f0e319113c6d8df248dff127b3410f13f2eaca269f47a8e688d
|
3 |
+
size 255757685
|
wikipedia_en_100_0/train-00016-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:295b0ac4587632ca492cb66d75a3cf8736c80a7eea545c0c84ee51f047cc6fd9
|
3 |
+
size 255981112
|
wikipedia_en_100_0/train-00017-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c0498780557e273d9181aebded5e6488123874d047d82a27ca6a2440e70215ef
|
3 |
+
size 252417941
|
wikipedia_en_100_0/train-00018-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f15a231883d3aa8e23eb3028932c727f23f897258730a574e0d686c68759fad4
|
3 |
+
size 252158485
|
wikipedia_en_100_0/train-00019-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9879d2a8c333d653eeff14741fd8c9dd9b77e12974364b651a00443b7ff2e0eb
|
3 |
+
size 254376700
|
wikipedia_en_100_0/train-00020-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:851b23cd6f5c5465ac7413b86064caeb6a082f1ec136c844ba2de58e93c97171
|
3 |
+
size 253096271
|
wikipedia_en_100_0/train-00021-of-00053.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9d0b80fc29aaa2101e2b8b45943491d350982aa79d98c99f25af94b2c5fa5571
|
3 |
+
size 252787011
|