Update ikcest2022.py
Browse files- ikcest2022.py +3 -10
ikcest2022.py
CHANGED
@@ -93,7 +93,7 @@ class IKCEST2022(datasets.GeneratorBasedBuilder):
|
|
93 |
source, target = self.config.pair.split("-")
|
94 |
dl_dir = dl_manager.download_and_extract(URL)
|
95 |
TARGET_LANGUAGE = target if target != SOURCE_LANGUAGE else source
|
96 |
-
data_dir = os.path.join(dl_dir, "ZhFrRuThArEn",f"{SOURCE_LANGUAGE}-{TARGET_LANGUAGE}")
|
97 |
|
98 |
return [
|
99 |
datasets.SplitGenerator(
|
@@ -102,7 +102,7 @@ class IKCEST2022(datasets.GeneratorBasedBuilder):
|
|
102 |
"source_files": [
|
103 |
os.path.join(
|
104 |
data_dir,
|
105 |
-
f"train.{self.config.pair}.{source}",
|
106 |
)
|
107 |
],
|
108 |
"target_files": [
|
@@ -149,14 +149,8 @@ class IKCEST2022(datasets.GeneratorBasedBuilder):
|
|
149 |
),
|
150 |
]
|
151 |
|
152 |
-
def _generate_examples(self, source_files, target_files):
|
153 |
"""Yields examples."""
|
154 |
-
# 如果只存了zh-fr.*,没有fr-zh.*,那么修改文件名。
|
155 |
-
'''
|
156 |
-
举个例子: source_files=zh-fr.zh target_files=zh-fr.fr √
|
157 |
-
source_files=fr-zh.fr target_files=fr-zh.zh x
|
158 |
-
source_files=test.fr-zh.fr target_files=test.fr-zh.zh √
|
159 |
-
'''
|
160 |
def _reverse_lang_pair(file_name):
|
161 |
'''
|
162 |
Reverses the language pair in a given file name.
|
@@ -178,7 +172,6 @@ class IKCEST2022(datasets.GeneratorBasedBuilder):
|
|
178 |
|
179 |
id_ = 0
|
180 |
source, target = self.config.pair.split("-")
|
181 |
-
# 将反向的路径映射到前向路径,如train.fr-zh.fr->train.zh-fr.fr
|
182 |
for idx in range(len(source_files)):
|
183 |
source_file, target_file = source_files[idx], target_files[idx]
|
184 |
if os.path.exists(source_file) and os.path.exists(target_file):
|
|
|
93 |
source, target = self.config.pair.split("-")
|
94 |
dl_dir = dl_manager.download_and_extract(URL)
|
95 |
TARGET_LANGUAGE = target if target != SOURCE_LANGUAGE else source
|
96 |
+
data_dir = os.path.join(dl_dir, "ZhFrRuThArEn",f"{SOURCE_LANGUAGE}-{TARGET_LANGUAGE}")
|
97 |
|
98 |
return [
|
99 |
datasets.SplitGenerator(
|
|
|
102 |
"source_files": [
|
103 |
os.path.join(
|
104 |
data_dir,
|
105 |
+
f"train.{self.config.pair}.{source}",
|
106 |
)
|
107 |
],
|
108 |
"target_files": [
|
|
|
149 |
),
|
150 |
]
|
151 |
|
152 |
+
def _generate_examples(self, source_files, target_files):
|
153 |
"""Yields examples."""
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
def _reverse_lang_pair(file_name):
|
155 |
'''
|
156 |
Reverses the language pair in a given file name.
|
|
|
172 |
|
173 |
id_ = 0
|
174 |
source, target = self.config.pair.split("-")
|
|
|
175 |
for idx in range(len(source_files)):
|
176 |
source_file, target_file = source_files[idx], target_files[idx]
|
177 |
if os.path.exists(source_file) and os.path.exists(target_file):
|