Xinyu Crystina ZHANG commited on
Commit
704ef7b
1 Parent(s): 7894a1d
.gitattributes CHANGED
@@ -25,3 +25,14 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ mrtydi-v1.1-finnish/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
29
+ mrtydi-v1.1-korean/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
30
+ mrtydi-v1.1-telugu/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
31
+ mrtydi-v1.1-arabic/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
32
+ mrtydi-v1.1-bengali/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
33
+ mrtydi-v1.1-english/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
34
+ mrtydi-v1.1-indonesian/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
35
+ mrtydi-v1.1-japanese/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
36
+ mrtydi-v1.1-russian/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
37
+ mrtydi-v1.1-swahili/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
38
+ mrtydi-v1.1-thai/corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
mr-tydi-corpus.py ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
16
+ # Lint as: python3
17
+
18
+ import json
19
+
20
+ import datasets
21
+ from dataclasses import dataclass
22
+
23
+ _CITATION = '''
24
+ @article{mrtydi,
25
+ title={{Mr. TyDi}: A Multi-lingual Benchmark for Dense Retrieval},
26
+ author={Xinyu Zhang and Xueguang Ma and Peng Shi and Jimmy Lin},
27
+ year={2021},
28
+ journal={arXiv:2108.08787},
29
+ }
30
+ '''
31
+
32
+ languages = [
33
+ 'arabic',
34
+ 'bengali',
35
+ 'english',
36
+ 'indonesian',
37
+ 'finnish',
38
+ 'korean',
39
+ 'russian',
40
+ 'swahili',
41
+ 'telugu',
42
+ 'thai',
43
+ 'japanese',
44
+ ]
45
+
46
+ _DESCRIPTION = 'dataset load script for Mr. TyDi'
47
+
48
+ _DATASET_URLS = {
49
+ lang: {
50
+ 'train': f'https://huggingface.co/datasets/castorini/mr-tydi-corpus/resolve/main/mrtydi-v1.1-{lang}/corpus.jsonl.gz',
51
+ } for lang in languages
52
+ }
53
+
54
+
55
+ class MrTyDiCorpus(datasets.GeneratorBasedBuilder):
56
+ BUILDER_CONFIGS = [
57
+ datasets.BuilderConfig(
58
+ version=datasets.Version('1.1.0'),
59
+ name=lang,
60
+ description=f'Mr TyDi dataset in language {lang}.'
61
+ ) for lang in languages
62
+ ]
63
+
64
+ def _info(self):
65
+ features = datasets.Features({
66
+ 'docid': datasets.Value('string'),
67
+ 'title': datasets.Value('string'),
68
+ 'text': datasets.Value('string'),
69
+ })
70
+
71
+ return datasets.DatasetInfo(
72
+ # This is the description that will appear on the datasets page.
73
+ description=_DESCRIPTION,
74
+ # This defines the different columns of the dataset and their types
75
+ features=features, # Here we define them above because they are different between the two configurations
76
+ supervised_keys=None,
77
+ # Homepage of the dataset for documentation
78
+ homepage='https://github.com/castorini/mr.tydi',
79
+ # License for the dataset if available
80
+ license='',
81
+ # Citation for the dataset
82
+ citation=_CITATION,
83
+ )
84
+
85
+ def _split_generators(self, dl_manager):
86
+ lang = self.config.name
87
+ downloaded_files = dl_manager.download_and_extract(_DATASET_URLS[lang])
88
+
89
+ splits = [
90
+ datasets.SplitGenerator(
91
+ name='train',
92
+ gen_kwargs={
93
+ 'filepath': downloaded_files['train'],
94
+ },
95
+ ),
96
+ ]
97
+ return splits
98
+
99
+ def _generate_examples(self, filepath):
100
+ with open(filepath, encoding="utf-8") as f:
101
+ for line in f:
102
+ data = json.loads(line)
103
+ yield data['docid'], data
mrtydi-v1.1-arabic/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccbc80461860d4fda51206e03eba709051683e07b3cee240ae463fbc816069ca
3
+ size 328027410
mrtydi-v1.1-bengali/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa7d762adc13a8a0ad3e01c369b017a8ace5058d57bcb6b1a4da263ea23fca04
3
+ size 60812633
mrtydi-v1.1-english/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:315744c964d467370c59a3d17cf6b2e50f6f3869dbf3067ac4f198dcb49f8cb0
3
+ size 5067943850
mrtydi-v1.1-finnish/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a9be442fc86f682a7f2a6e17cb6e90e162e8749f7f2d7933a654c180a6762fb
3
+ size 273967576
mrtydi-v1.1-indonesian/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9a5fe3e10a913baea9c3679360ef60687f3b5b4c4003a9d2b37b0eb8009620b
3
+ size 172722657
mrtydi-v1.1-japanese/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51c19472cbdd4a36e84548dec3db0667a5c05747d356c696a6c61c1c29fbb4eb
3
+ size 1077923198
mrtydi-v1.1-korean/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21a97a477be8763e1cee09e0a6e923e6463fdca8063078e0cedd1fc887439085
3
+ size 227545912
mrtydi-v1.1-russian/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c468bdb502a2f596469b3bb52448f670a1efd2ab7301beab79753c14cfd5bb79
3
+ size 1588019137
mrtydi-v1.1-swahili/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be45a839aa4445fb77ae8e43974a5310abc5665e1750bcedf7e7d5134e292fe1
3
+ size 10739001
mrtydi-v1.1-telugu/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6142ecfdfba4c77e60296bf3f62a48661db237057aa7c7facb4f92c213065726
3
+ size 75245831
mrtydi-v1.1-thai/corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03464e4539d3bd5fbcc2cc621e3a5736f4dc349406d852b36dbc309e681e5b1d
3
+ size 114621663