Datasets:
Update
Browse files- ELRC-Medical-V2.py +27 -11
ELRC-Medical-V2.py
CHANGED
@@ -56,15 +56,21 @@ class ELRC_Medical_V2(datasets.GeneratorBasedBuilder):
|
|
56 |
DEFAULT_CONFIG_NAME = "en-fr"
|
57 |
|
58 |
def _info(self):
|
|
|
|
|
59 |
return datasets.DatasetInfo(
|
60 |
description=_DESCRIPTION,
|
61 |
-
features=datasets.Features(
|
62 |
-
"
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
68 |
homepage="https://github.com/qanastek/ELRC-Medical-V2/",
|
69 |
citation=_CITATION,
|
70 |
license=_LICENSE,
|
@@ -91,6 +97,9 @@ class ELRC_Medical_V2(datasets.GeneratorBasedBuilder):
|
|
91 |
|
92 |
logger.info("⏳ Generating examples from = %s", filepath)
|
93 |
|
|
|
|
|
|
|
94 |
key_ = 0
|
95 |
|
96 |
with open(filepath, encoding="utf-8") as f:
|
@@ -101,10 +110,17 @@ class ELRC_Medical_V2(datasets.GeneratorBasedBuilder):
|
|
101 |
continue
|
102 |
|
103 |
yield key_, {
|
104 |
-
"
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
key_ += 1
|
|
|
56 |
DEFAULT_CONFIG_NAME = "en-fr"
|
57 |
|
58 |
def _info(self):
|
59 |
+
src, target = self.config.name.split("-")
|
60 |
+
pair = (src, target)
|
61 |
return datasets.DatasetInfo(
|
62 |
description=_DESCRIPTION,
|
63 |
+
features=datasets.Features(
|
64 |
+
{"translation": datasets.features.Translation(languages=pair)}
|
65 |
+
),
|
66 |
+
supervised_keys=(src, target),
|
67 |
+
# features=datasets.Features({
|
68 |
+
# "doc_id": datasets.Value("int32"),
|
69 |
+
# "lang": datasets.Value("string"),
|
70 |
+
# "source_text": datasets.Value("string"),
|
71 |
+
# "target_text": datasets.Value("string"),
|
72 |
+
# }),
|
73 |
+
# supervised_keys=None,
|
74 |
homepage="https://github.com/qanastek/ELRC-Medical-V2/",
|
75 |
citation=_CITATION,
|
76 |
license=_LICENSE,
|
|
|
97 |
|
98 |
logger.info("⏳ Generating examples from = %s", filepath)
|
99 |
|
100 |
+
src, target = str(row[1]).split("-")
|
101 |
+
pair = (src, target)
|
102 |
+
|
103 |
key_ = 0
|
104 |
|
105 |
with open(filepath, encoding="utf-8") as f:
|
|
|
110 |
continue
|
111 |
|
112 |
yield key_, {
|
113 |
+
"translation": {
|
114 |
+
src: str(row[2]).strip(),
|
115 |
+
target: str(row[3]).strip(),
|
116 |
+
}
|
117 |
}
|
118 |
|
119 |
+
# yield key_, {
|
120 |
+
# "doc_id": int(row[0]),
|
121 |
+
# "lang": str(row[1]),
|
122 |
+
# "source_text": str(row[2]),
|
123 |
+
# "target_text": str(row[3])
|
124 |
+
# }
|
125 |
+
|
126 |
key_ += 1
|