Datasets:
mteb
/

Modalities:
Text
Formats:
json
ArXiv:
Libraries:
Datasets
Dask
License:
loicmagne commited on
Commit
36ea601
·
1 Parent(s): f66b266
Files changed (1) hide show
  1. bucc-bitext-mining.py +68 -0
bucc-bitext-mining.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+ """BUCC"""
4
+
5
+ import json
6
+ import datasets
7
+ import os
8
+ import gzip
9
+
10
+ logger = datasets.logging.get_logger(__name__)
11
+
12
+ _DESCRIPTION = """\
13
+ Tatoeba multilingual test set
14
+ """
15
+
16
+ _LANGUAGES = [
17
+ 'de-en',
18
+ 'fr-en',
19
+ 'ru-en',
20
+ 'zh-en'
21
+ ]
22
+
23
+ class BUCC(datasets.GeneratorBasedBuilder):
24
+ """BUCC Cross-lingual"""
25
+
26
+ BUILDER_CONFIGS = [
27
+ datasets.BuilderConfig(
28
+ name=name,
29
+ version=datasets.Version("1.0.0"),
30
+ description=f"Tatoeba cross-lingual dataset for {name} language pair.",
31
+ )
32
+ for name in _LANGUAGES
33
+ ]
34
+
35
+ DEFAULT_CONFIG_NAME = 'fra-eng'
36
+
37
+ def _info(self):
38
+ return datasets.DatasetInfo(
39
+ description=_DESCRIPTION,
40
+ features=datasets.Features(
41
+ {
42
+ "sentence1": datasets.Sequence(datasets.Value("string"))
43
+ "sentence2": datasets.Sequence(datasets.Value("string"))
44
+ "sentence1": datasets.Sequence([datasets.Value("int"),datasets.Value("int")])
45
+ },
46
+ ),
47
+ supervised_keys=None,
48
+ homepage="https://comparable.limsi.fr/bucc2018/bucc2018-task.html",
49
+ )
50
+
51
+ def _split_generators(self, dl_manager):
52
+ url = f'{self.config.name}/test.jsonl.gz'
53
+ archive_path = dl_manager.download(url)
54
+
55
+ return [
56
+ datasets.SplitGenerator(
57
+ name=datasets.Split.TEST,
58
+ gen_kwargs={
59
+ "text_path": archive_path,
60
+ },
61
+ ),
62
+ ]
63
+
64
+ def _generate_examples(self, text_path):
65
+ """Yields examples."""
66
+ with gzip.open(text_path,'rt') as f:
67
+ for i, line in enumerate(f):
68
+ yield i, json.loads(line)