Datasets:
Sean MacAvaney
commited on
Commit
•
afd48cc
1
Parent(s):
b25df7a
added data loading script and dataset card
Browse files- README.md +64 -0
- neumarco.py +40 -0
README.md
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- machine-generated
|
4 |
+
language:
|
5 |
+
- fa
|
6 |
+
- ru
|
7 |
+
- zh
|
8 |
+
language_creators:
|
9 |
+
- machine-generated
|
10 |
+
multilinguality:
|
11 |
+
- multilingual
|
12 |
+
pretty_name: NeuMARCO
|
13 |
+
size_categories:
|
14 |
+
- 1M<n<10M
|
15 |
+
source_datasets:
|
16 |
+
- extended|irds/msmarco-passage
|
17 |
+
tags: []
|
18 |
+
task_categories:
|
19 |
+
- text-retrieval
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for NeuMARCO
|
23 |
+
|
24 |
+
## Dataset Description
|
25 |
+
|
26 |
+
- **Website:** https://neuclir.github.io/
|
27 |
+
|
28 |
+
### Dataset Summary
|
29 |
+
|
30 |
+
This is the dataset created for TREC 2022 NeuCLIR Track. The collection consists of documents from [`msmarco-passage`](ir-datasets.com/msmarco-passage) translated into
|
31 |
+
Chinese, Persian, and Russian.
|
32 |
+
|
33 |
+
### Languages
|
34 |
+
|
35 |
+
- Chinese
|
36 |
+
- Persian
|
37 |
+
- Russian
|
38 |
+
|
39 |
+
## Dataset Structure
|
40 |
+
|
41 |
+
### Data Instances
|
42 |
+
|
43 |
+
| Split | Documents |
|
44 |
+
|-----------------|----------:|
|
45 |
+
| `fas` (Persian) | 8.8M |
|
46 |
+
| `rus` (Russian) | 8.8M |
|
47 |
+
| `zho` (Chinese) | 8.8M |
|
48 |
+
|
49 |
+
### Data Fields
|
50 |
+
- `doc_id`: unique identifier for this document
|
51 |
+
- `text`: translated passage text
|
52 |
+
|
53 |
+
## Dataset Usage
|
54 |
+
|
55 |
+
Using 🤗 Datasets:
|
56 |
+
|
57 |
+
```python
|
58 |
+
from datasets import load_dataset
|
59 |
+
|
60 |
+
dataset = load_dataset('neuclir/neumarco')
|
61 |
+
dataset['fas'] # Persian passages
|
62 |
+
dataset['rus'] # Russian passages
|
63 |
+
dataset['zho'] # Chinese passages
|
64 |
+
```
|
neumarco.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import tarfile
|
2 |
+
import os
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
_URL = "https://huggingface.co/datasets/neuclir/neumarco/resolve/main/data/neumarco.tar.gz"
|
6 |
+
|
7 |
+
|
8 |
+
class Neumarco(datasets.GeneratorBasedBuilder):
|
9 |
+
VERSION = datasets.Version("1.0.0")
|
10 |
+
|
11 |
+
def _info(self):
|
12 |
+
return datasets.DatasetInfo(
|
13 |
+
features=datasets.Features({
|
14 |
+
"doc_id": datasets.Value("string"),
|
15 |
+
"text": datasets.Value("string"),
|
16 |
+
}),
|
17 |
+
)
|
18 |
+
|
19 |
+
def _split_generators(self, dl_manager):
|
20 |
+
path = dl_manager.download(_URL)
|
21 |
+
return [
|
22 |
+
datasets.SplitGenerator(
|
23 |
+
name=lang,
|
24 |
+
gen_kwargs={
|
25 |
+
"filepath": path,
|
26 |
+
"tarpath": f'eng-{lang}/msmarco.collection.20210731-scale21-sockeye2-tm1.tsv'
|
27 |
+
})
|
28 |
+
for lang in ['fas', 'rus', 'zho']
|
29 |
+
]
|
30 |
+
|
31 |
+
def _generate_examples(self, filepath, tarpath):
|
32 |
+
with tarfile.open(filepath, 'r|gz') as tarf:
|
33 |
+
for fileinfo in tarf:
|
34 |
+
if fileinfo.name != tarpath:
|
35 |
+
continue
|
36 |
+
with tarf.extractfile(fileinfo) as f:
|
37 |
+
for key, line in enumerate(f):
|
38 |
+
doc_id, text = line.decode('utf8').rstrip('\n').split('\t')
|
39 |
+
yield key, {'doc_id': doc_id, 'text': text}
|
40 |
+
break
|