Datasets:
Update divemt.py
Browse files
divemt.py
CHANGED
|
@@ -35,12 +35,22 @@ _ALL_FIELDS = ['unit_id', 'flores_id', 'item_id', 'subject_id', 'task_type',
|
|
| 35 |
'len_pause_geq_300', 'n_pause_geq_1000', 'len_pause_geq_1000',
|
| 36 |
'event_time', 'num_annotations', 'last_modification_time', 'n_insert',
|
| 37 |
'n_delete', 'n_substitute', 'n_shift', 'tot_shifted_words', 'tot_edits',
|
| 38 |
-
'hter', 'bleu', 'chrf', 'lang_id', 'doc_id', 'time_s', 'time_m',
|
| 39 |
'time_h', 'time_per_char', 'time_per_word', 'key_per_char',
|
| 40 |
'words_per_hour', 'words_per_minute', 'per_subject_visit_order',
|
| 41 |
'src_text', 'mt_text', 'tgt_text', 'aligned_edit'
|
| 42 |
]
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
class DivEMTConfig(datasets.BuilderConfig):
|
| 45 |
"""BuilderConfig for the DivEMT Dataset."""
|
| 46 |
|
|
@@ -74,10 +84,10 @@ class IkNlp22PEStyle(datasets.GeneratorBasedBuilder):
|
|
| 74 |
|
| 75 |
def _info(self):
|
| 76 |
features = {feature: datasets.Value("int32") for feature in self.config.features}
|
| 77 |
-
for field in
|
| 78 |
if field in self.config.features:
|
| 79 |
features[field] = datasets.Value("string")
|
| 80 |
-
for field in
|
| 81 |
if field in self.config.features:
|
| 82 |
features[field] = datasets.Value("float32")
|
| 83 |
return datasets.DatasetInfo(
|
|
|
|
| 35 |
'len_pause_geq_300', 'n_pause_geq_1000', 'len_pause_geq_1000',
|
| 36 |
'event_time', 'num_annotations', 'last_modification_time', 'n_insert',
|
| 37 |
'n_delete', 'n_substitute', 'n_shift', 'tot_shifted_words', 'tot_edits',
|
| 38 |
+
'hter', 'cer', 'bleu', 'chrf', 'lang_id', 'doc_id', 'time_s', 'time_m',
|
| 39 |
'time_h', 'time_per_char', 'time_per_word', 'key_per_char',
|
| 40 |
'words_per_hour', 'words_per_minute', 'per_subject_visit_order',
|
| 41 |
'src_text', 'mt_text', 'tgt_text', 'aligned_edit'
|
| 42 |
]
|
| 43 |
|
| 44 |
+
_FLOAT_FIELDS = ["edit_time", "bleu", "chrf", "hter", "n_insert", "n_delete", "n_substitute",
|
| 45 |
+
"n_shift", "time_s", "time_m", "time_h", 'time_per_char', 'time_per_word', 'key_per_char',
|
| 46 |
+
'words_per_hour', 'words_per_minute', 'tot_shifted_words', 'tot_edits', "mt_len_chr",
|
| 47 |
+
"mt_len_wrd", "cer"
|
| 48 |
+
]
|
| 49 |
+
|
| 50 |
+
_STR_FIELDS = ["unit_id", "item_id", "subject_id", "lang_id", "task_type", "translation_type",
|
| 51 |
+
"src_text", "mt_text", "tgt_text", "aligned_edit"
|
| 52 |
+
]
|
| 53 |
+
|
| 54 |
class DivEMTConfig(datasets.BuilderConfig):
|
| 55 |
"""BuilderConfig for the DivEMT Dataset."""
|
| 56 |
|
|
|
|
| 84 |
|
| 85 |
def _info(self):
|
| 86 |
features = {feature: datasets.Value("int32") for feature in self.config.features}
|
| 87 |
+
for field in _STR_FIELDS:
|
| 88 |
if field in self.config.features:
|
| 89 |
features[field] = datasets.Value("string")
|
| 90 |
+
for field in _FLOAT_FIELDS:
|
| 91 |
if field in self.config.features:
|
| 92 |
features[field] = datasets.Value("float32")
|
| 93 |
return datasets.DatasetInfo(
|