Update semi-text-c.py
Browse files- semi-text-c.py +6 -6
semi-text-c.py
CHANGED
|
@@ -26,7 +26,7 @@ class semiTextc(datasets.GeneratorBasedBuilder):
|
|
| 26 |
features={
|
| 27 |
"content": datasets.Value("string"),
|
| 28 |
},
|
| 29 |
-
data_url="https://huggingface.co/datasets/matchbench/semi-
|
| 30 |
),
|
| 31 |
|
| 32 |
semiTextcConfig(
|
|
@@ -34,7 +34,7 @@ class semiTextc(datasets.GeneratorBasedBuilder):
|
|
| 34 |
features={
|
| 35 |
"content": datasets.Value("string"),
|
| 36 |
},
|
| 37 |
-
data_url="https://huggingface.co/datasets/matchbench/semi-
|
| 38 |
),
|
| 39 |
]
|
| 40 |
|
|
@@ -65,19 +65,19 @@ class semiTextc(datasets.GeneratorBasedBuilder):
|
|
| 65 |
"path_file": dl_manager.download_and_extract(self.config.data_url), "split": "target", })]
|
| 66 |
|
| 67 |
def _generate_examples(self, path_file, split):
|
| 68 |
-
if split in ['
|
| 69 |
with open(path_file, "r") as f:
|
| 70 |
file = json.load(f)
|
| 71 |
for i in range(len(file)):
|
| 72 |
yield i, {
|
| 73 |
"content": file[i]
|
| 74 |
}
|
| 75 |
-
elif split in ['
|
| 76 |
with open(path_file, "r") as f:
|
| 77 |
-
file =
|
| 78 |
for i in range(len(file)):
|
| 79 |
yield i, {
|
| 80 |
-
"content": file[i]
|
| 81 |
}
|
| 82 |
else:
|
| 83 |
file = pd.read_csv(path_file)
|
|
|
|
| 26 |
features={
|
| 27 |
"content": datasets.Value("string"),
|
| 28 |
},
|
| 29 |
+
data_url="https://huggingface.co/datasets/matchbench/semi-Text-c/resolve/main/left.json",
|
| 30 |
),
|
| 31 |
|
| 32 |
semiTextcConfig(
|
|
|
|
| 34 |
features={
|
| 35 |
"content": datasets.Value("string"),
|
| 36 |
},
|
| 37 |
+
data_url="https://huggingface.co/datasets/matchbench/semi-Text-c/resolve/main/right.txt",
|
| 38 |
),
|
| 39 |
]
|
| 40 |
|
|
|
|
| 65 |
"path_file": dl_manager.download_and_extract(self.config.data_url), "split": "target", })]
|
| 66 |
|
| 67 |
def _generate_examples(self, path_file, split):
|
| 68 |
+
if split in ['source']:
|
| 69 |
with open(path_file, "r") as f:
|
| 70 |
file = json.load(f)
|
| 71 |
for i in range(len(file)):
|
| 72 |
yield i, {
|
| 73 |
"content": file[i]
|
| 74 |
}
|
| 75 |
+
elif split in ['target']:
|
| 76 |
with open(path_file, "r") as f:
|
| 77 |
+
file = f.readlines()
|
| 78 |
for i in range(len(file)):
|
| 79 |
yield i, {
|
| 80 |
+
"content": file[i].strip('\n')
|
| 81 |
}
|
| 82 |
else:
|
| 83 |
file = pd.read_csv(path_file)
|