Datasets:

Multilinguality:
translation
Size Categories:
1K<n<10K
Language Creators:
found
Source Datasets:
original
ArXiv:
Tags:
License:
gsarti commited on
Commit
d974eb1
1 Parent(s): d08c59f

Update divemt.py

Browse files
Files changed (1) hide show
  1. divemt.py +10 -7
divemt.py CHANGED
@@ -1,5 +1,5 @@
1
  import os
2
-
3
  import datasets
4
  import pandas as pd
5
 
@@ -22,11 +22,11 @@ _HOMEPAGE = "https://github.com/gsarti/divemt"
22
 
23
  _LICENSE = "GNU General Public License v3.0"
24
 
25
- _ROOT_PATH = "https://raw.githubusercontent.com/gsarti/divemt/main/data/"
26
 
27
  _PATHS = {
28
- "main": os.path.join(_ROOT_PATH, "main.tsv.zip"),
29
- "warmup": os.path.join(_ROOT_PATH, "warmup.tsv.zip"),
30
  }
31
 
32
  _ALL_FIELDS = ['unit_id', 'flores_id', 'item_id', 'subject_id', 'lang_id', 'doc_id',
@@ -128,7 +128,7 @@ class DivEMT(datasets.GeneratorBasedBuilder):
128
 
129
  def _split_generators(self, dl_manager):
130
  """Returns SplitGenerators."""
131
- dl_dir = dl_manager.download(_PATHS[self.config.name])
132
  return [
133
  datasets.SplitGenerator(
134
  name=datasets.Split.TRAIN,
@@ -141,7 +141,10 @@ class DivEMT(datasets.GeneratorBasedBuilder):
141
 
142
  def _generate_examples(self, filepath: str, features):
143
  """Yields examples as (key, example) tuples."""
144
- data = pd.read_csv(filepath, sep="\t", compression="zip")
145
  data = data[features]
146
  for id_, row in data.iterrows():
147
- yield id_, row.to_dict()
 
 
 
 
1
  import os
2
+ import json
3
  import datasets
4
  import pandas as pd
5
 
 
22
 
23
  _LICENSE = "GNU General Public License v3.0"
24
 
25
+ _ROOT_PATH = "https://huggingface.co/datasets/GroNLP/divemt/raw/main"
26
 
27
  _PATHS = {
28
+ "main": os.path.join(_ROOT_PATH, "main.tsv"),
29
+ "warmup": os.path.join(_ROOT_PATH, "warmup.tsv"),
30
  }
31
 
32
  _ALL_FIELDS = ['unit_id', 'flores_id', 'item_id', 'subject_id', 'lang_id', 'doc_id',
 
128
 
129
  def _split_generators(self, dl_manager):
130
  """Returns SplitGenerators."""
131
+ dl_dir = dl_manager.download_and_extract(_PATHS[self.config.name])
132
  return [
133
  datasets.SplitGenerator(
134
  name=datasets.Split.TRAIN,
 
141
 
142
  def _generate_examples(self, filepath: str, features):
143
  """Yields examples as (key, example) tuples."""
144
+ data = pd.read_csv(filepath, sep="\t")
145
  data = data[features]
146
  for id_, row in data.iterrows():
147
+ row_dic = row.to_dict()
148
+ for field in _STR_SEQ_FIELDS + _LANG_ANNOTATIONS_FIELDS:
149
+ row_dic[field] = json.loads(row_dic[field])
150
+ yield id_, row_dic