Datasets:
Update divemt.py
Browse files
divemt.py
CHANGED
@@ -40,7 +40,8 @@ _ALL_FIELDS = ['unit_id', 'flores_id', 'item_id', 'subject_id', 'task_type',
|
|
40 |
'hter', 'cer', 'bleu', 'chrf', 'lang_id', 'doc_id', 'time_s', 'time_m',
|
41 |
'time_h', 'time_per_char', 'time_per_word', 'key_per_char',
|
42 |
'words_per_hour', 'words_per_minute', 'per_subject_visit_order',
|
43 |
-
'src_text', 'mt_text', 'tgt_text', 'aligned_edit'
|
|
|
44 |
]
|
45 |
|
46 |
_FLOAT_FIELDS = ["edit_time", "bleu", "chrf", "hter", "n_insert", "n_delete", "n_substitute",
|
@@ -53,6 +54,11 @@ _STR_FIELDS = ["unit_id", "item_id", "subject_id", "lang_id", "task_type", "tran
|
|
53 |
"src_text", "mt_text", "tgt_text", "aligned_edit"
|
54 |
]
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
class DivEMTConfig(datasets.BuilderConfig):
|
57 |
"""BuilderConfig for the DivEMT Dataset."""
|
58 |
|
@@ -86,12 +92,32 @@ class DivEMT(datasets.GeneratorBasedBuilder):
|
|
86 |
|
87 |
def _info(self):
|
88 |
features = {feature: datasets.Value("int32") for feature in self.config.features}
|
89 |
-
for field in
|
90 |
-
if field in self.config.features:
|
91 |
-
features[field] = datasets.Value("string")
|
92 |
-
for field in _FLOAT_FIELDS:
|
93 |
if field in self.config.features:
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
return datasets.DatasetInfo(
|
96 |
description=_DESCRIPTION,
|
97 |
features=datasets.Features(features),
|
|
|
40 |
'hter', 'cer', 'bleu', 'chrf', 'lang_id', 'doc_id', 'time_s', 'time_m',
|
41 |
'time_h', 'time_per_char', 'time_per_word', 'key_per_char',
|
42 |
'words_per_hour', 'words_per_minute', 'per_subject_visit_order',
|
43 |
+
'src_text', 'mt_text', 'tgt_text', 'aligned_edit', 'src_tokens', 'src_annotations',
|
44 |
+
'mt_tokens', 'mt_annotations', 'tgt_tokens', 'tgt_annotations'
|
45 |
]
|
46 |
|
47 |
_FLOAT_FIELDS = ["edit_time", "bleu", "chrf", "hter", "n_insert", "n_delete", "n_substitute",
|
|
|
54 |
"src_text", "mt_text", "tgt_text", "aligned_edit"
|
55 |
]
|
56 |
|
57 |
+
_STR_SEQ_FIELDS = ['src_tokens', 'mt_tokens', 'tgt_tokens']
|
58 |
+
|
59 |
+
_LANG_ANNOTATIONS_FIELDS = ['src_annotations', 'mt_annotations', 'tgt_annotations']
|
60 |
+
|
61 |
+
|
62 |
class DivEMTConfig(datasets.BuilderConfig):
|
63 |
"""BuilderConfig for the DivEMT Dataset."""
|
64 |
|
|
|
92 |
|
93 |
def _info(self):
|
94 |
features = {feature: datasets.Value("int32") for feature in self.config.features}
|
95 |
+
for field in _ALL_FIELDS:
|
|
|
|
|
|
|
96 |
if field in self.config.features:
|
97 |
+
if field in _STR_FIELDS:
|
98 |
+
features[field] = datasets.Value("string")
|
99 |
+
if field in _FLOAT_FIELDS:
|
100 |
+
features[field] = datasets.Value("float32")
|
101 |
+
if field in _STR_SEQ_FIELDS:
|
102 |
+
features[field] = datasets.Sequence(datasets.Value("string"))
|
103 |
+
if field in _LANG_ANNOTATIONS_FIELDS:
|
104 |
+
features[field] = datasets.features.Sequence(
|
105 |
+
datasets.features.Sequence(
|
106 |
+
{
|
107 |
+
"id": datasets.Value("int8"),
|
108 |
+
"text": datasets.Value("string"),
|
109 |
+
"lemma": datasets.Value("string"),
|
110 |
+
"upos": datasets.Value("string"),
|
111 |
+
"xpos": datasets.Value("string"),
|
112 |
+
"feats": datasets.Value("string"),
|
113 |
+
"head": datasets.Value("int8"),
|
114 |
+
"deprel": datasets.Value("string"),
|
115 |
+
"start_char": datasets.Value("int8"),
|
116 |
+
"end_char": datasets.Value("int8"),
|
117 |
+
"ner": datasets.Value("string"),
|
118 |
+
}
|
119 |
+
)
|
120 |
+
)
|
121 |
return datasets.DatasetInfo(
|
122 |
description=_DESCRIPTION,
|
123 |
features=datasets.Features(features),
|