Datasets:
Update URL
Browse files- EMEA-V3.py +17 -25
EMEA-V3.py
CHANGED
@@ -3,10 +3,8 @@
|
|
3 |
|
4 |
"""EMEA-V3 : European parallel translation corpus from the European Medicines Agency"""
|
5 |
|
6 |
-
import os
|
7 |
-
import csv
|
8 |
import datasets
|
9 |
-
|
10 |
|
11 |
logger = datasets.logging.get_logger(__name__)
|
12 |
|
@@ -65,7 +63,7 @@ class EMEA_V3(datasets.GeneratorBasedBuilder):
|
|
65 |
def _split_generators(self, dl_manager):
|
66 |
|
67 |
# Download the CSV
|
68 |
-
data_dir = dl_manager.
|
69 |
|
70 |
return [
|
71 |
datasets.SplitGenerator(
|
@@ -82,29 +80,23 @@ class EMEA_V3(datasets.GeneratorBasedBuilder):
|
|
82 |
logger.info("⏳ Generating examples from = %s", filepath)
|
83 |
|
84 |
key_ = 0
|
|
|
|
|
85 |
|
86 |
-
|
87 |
|
88 |
-
|
|
|
|
|
89 |
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
|
100 |
-
|
101 |
-
src, target = str(row[0]).split("-")
|
102 |
-
|
103 |
-
yield key_, {
|
104 |
-
"translation": {
|
105 |
-
src: str(row[1]).strip(),
|
106 |
-
target: str(row[2]).strip(),
|
107 |
-
},
|
108 |
-
}
|
109 |
-
|
110 |
-
key_ += 1
|
|
|
3 |
|
4 |
"""EMEA-V3 : European parallel translation corpus from the European Medicines Agency"""
|
5 |
|
|
|
|
|
6 |
import datasets
|
7 |
+
import pandas as pd
|
8 |
|
9 |
logger = datasets.logging.get_logger(__name__)
|
10 |
|
|
|
63 |
def _split_generators(self, dl_manager):
|
64 |
|
65 |
# Download the CSV
|
66 |
+
data_dir = dl_manager.download(_URL.format(self.config.name))
|
67 |
|
68 |
return [
|
69 |
datasets.SplitGenerator(
|
|
|
80 |
logger.info("⏳ Generating examples from = %s", filepath)
|
81 |
|
82 |
key_ = 0
|
83 |
+
|
84 |
+
df = pd.read_csv(filepath, compression='gzip', header=0, sep=',')
|
85 |
|
86 |
+
for index, row in df.iterrows():
|
87 |
|
88 |
+
print(row['lang'])
|
89 |
+
print(row['source_text'])
|
90 |
+
print(row['target_text'])
|
91 |
|
92 |
+
# Get langue pair
|
93 |
+
src, target = str(row['lang']).split("-")
|
94 |
|
95 |
+
yield key_, {
|
96 |
+
"translation": {
|
97 |
+
src: str(row['source_text']).strip(),
|
98 |
+
target: str(row['target_text']).strip(),
|
99 |
+
},
|
100 |
+
}
|
101 |
|
102 |
+
key_ += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|