Datasets:
mteb
/

Modalities:
Text
ArXiv:
License:
orionweller commited on
Commit
66d0fd6
·
1 Parent(s): 7ce4f52
Files changed (1) hide show
  1. neuclir-2023.py +21 -3
neuclir-2023.py CHANGED
@@ -30,6 +30,12 @@ _DATASET_CORPUS_URLS = {
30
  } for lang in _LANGUAGES
31
  }
32
 
 
 
 
 
 
 
33
 
34
  class MLDR(datasets.GeneratorBasedBuilder):
35
  BUILDER_CONFIGS = [datasets.BuilderConfig(
@@ -41,6 +47,12 @@ class MLDR(datasets.GeneratorBasedBuilder):
41
  version=datasets.Version('1.0.0'),
42
  name=f'corpus-{lang}', description=f'corpus of NeuCLIR dataset in language {lang}.'
43
  ) for lang in _LANGUAGES
 
 
 
 
 
 
44
  ]
45
 
46
  def _info(self):
@@ -50,11 +62,17 @@ class MLDR(datasets.GeneratorBasedBuilder):
50
  '_id': datasets.Value('string'),
51
  'text': datasets.Value('string'),
52
  })
53
- else:
54
  features = datasets.Features({
55
  '_id': datasets.Value('string'),
56
  'query': datasets.Value('string'),
57
  })
 
 
 
 
 
 
58
 
59
  return datasets.DatasetInfo(
60
  # This is the description that will appear on the datasets page.
@@ -84,7 +102,7 @@ class MLDR(datasets.GeneratorBasedBuilder):
84
  ]
85
  elif name.startswith("queries-"):
86
  lang = name.split("-")[1]
87
- downloaded_files = dl_manager.download_and_extract(_DATASET_URLS[lang])
88
  splits = [
89
  datasets.SplitGenerator(
90
  name='queries',
@@ -122,5 +140,5 @@ class MLDR(datasets.GeneratorBasedBuilder):
122
  with open(filepath, encoding="utf-8") as f:
123
  for line in f:
124
  data = json.loads(line)
125
- qid = data['_id']
126
  yield qid, data
 
30
  } for lang in _LANGUAGES
31
  }
32
 
33
+ _DATASET_QUERIES_URLS = {
34
+ f'queries={lang}': {
35
+ 'queries': f'https://huggingface.co/datasets/MTEB/neuclir-2023/resolve/main/neuclir-{lang}/queries.jsonl'
36
+ } for lang in _LANGUAGES
37
+ }
38
+
39
 
40
  class MLDR(datasets.GeneratorBasedBuilder):
41
  BUILDER_CONFIGS = [datasets.BuilderConfig(
 
47
  version=datasets.Version('1.0.0'),
48
  name=f'corpus-{lang}', description=f'corpus of NeuCLIR dataset in language {lang}.'
49
  ) for lang in _LANGUAGES
50
+ ] +
51
+ [
52
+ datasets.BuilderConfig(
53
+ version=datasets.Version('1.0.0'),
54
+ name='queries', description='queries of NeuCLIR dataset.'
55
+ )
56
  ]
57
 
58
  def _info(self):
 
62
  '_id': datasets.Value('string'),
63
  'text': datasets.Value('string'),
64
  })
65
+ elif name.startswith("queries-"):
66
  features = datasets.Features({
67
  '_id': datasets.Value('string'),
68
  'query': datasets.Value('string'),
69
  })
70
+ else:
71
+ features = datasets.Features({
72
+ 'query-id': datasets.Value('string'),
73
+ 'corpus-id': datasets.Value('string'),
74
+ 'score': datasets.Value('int32'),
75
+ })
76
 
77
  return datasets.DatasetInfo(
78
  # This is the description that will appear on the datasets page.
 
102
  ]
103
  elif name.startswith("queries-"):
104
  lang = name.split("-")[1]
105
+ downloaded_files = dl_manager.download_and_extract(_DATASET_QUERIES_URLS[lang])
106
  splits = [
107
  datasets.SplitGenerator(
108
  name='queries',
 
140
  with open(filepath, encoding="utf-8") as f:
141
  for line in f:
142
  data = json.loads(line)
143
+ qid = data['query-id']
144
  yield qid, data