open file in utf-8 (#11)
Browse files
JGLUE.py
CHANGED
@@ -275,11 +275,11 @@ def get_filter_review_id_list(
|
|
275 |
filter_review_id_list = {}
|
276 |
|
277 |
if filter_review_id_list_valid is not None:
|
278 |
-
with open(filter_review_id_list_valid, "r") as rf:
|
279 |
filter_review_id_list["valid"] = [line.rstrip() for line in rf]
|
280 |
|
281 |
if filter_review_id_list_test is not None:
|
282 |
-
with open(filter_review_id_list_test, "r") as rf:
|
283 |
filter_review_id_list["test"] = [line.rstrip() for line in rf]
|
284 |
|
285 |
return filter_review_id_list
|
@@ -296,13 +296,13 @@ def get_label_conv_review_id_list(
|
|
296 |
label_conv_review_id_list: Dict[str, Dict[str, str]] = {}
|
297 |
|
298 |
if label_conv_review_id_list_valid is not None:
|
299 |
-
with open(label_conv_review_id_list_valid, "r") as rf:
|
300 |
label_conv_review_id_list["valid"] = {
|
301 |
row[0]: row[1] for row in csv.reader(rf)
|
302 |
}
|
303 |
|
304 |
if label_conv_review_id_list_test is not None:
|
305 |
-
with open(label_conv_review_id_list_test, "r") as rf:
|
306 |
label_conv_review_id_list["test"] = {
|
307 |
row[0]: row[1] for row in csv.reader(rf)
|
308 |
}
|
@@ -565,7 +565,7 @@ class JGLUE(ds.GeneratorBasedBuilder):
|
|
565 |
if file_path is None:
|
566 |
raise ValueError(f"Invalid argument for {self.config.name}")
|
567 |
|
568 |
-
with open(file_path, "r") as rf:
|
569 |
json_data = json.load(rf)
|
570 |
|
571 |
for json_dict in json_data["data"]:
|
|
|
275 |
filter_review_id_list = {}
|
276 |
|
277 |
if filter_review_id_list_valid is not None:
|
278 |
+
with open(filter_review_id_list_valid, "r", encoding="utf-8") as rf:
|
279 |
filter_review_id_list["valid"] = [line.rstrip() for line in rf]
|
280 |
|
281 |
if filter_review_id_list_test is not None:
|
282 |
+
with open(filter_review_id_list_test, "r", encoding="utf-8") as rf:
|
283 |
filter_review_id_list["test"] = [line.rstrip() for line in rf]
|
284 |
|
285 |
return filter_review_id_list
|
|
|
296 |
label_conv_review_id_list: Dict[str, Dict[str, str]] = {}
|
297 |
|
298 |
if label_conv_review_id_list_valid is not None:
|
299 |
+
with open(label_conv_review_id_list_valid, "r", encoding="utf-8") as rf:
|
300 |
label_conv_review_id_list["valid"] = {
|
301 |
row[0]: row[1] for row in csv.reader(rf)
|
302 |
}
|
303 |
|
304 |
if label_conv_review_id_list_test is not None:
|
305 |
+
with open(label_conv_review_id_list_test, "r", encoding="utf-8") as rf:
|
306 |
label_conv_review_id_list["test"] = {
|
307 |
row[0]: row[1] for row in csv.reader(rf)
|
308 |
}
|
|
|
565 |
if file_path is None:
|
566 |
raise ValueError(f"Invalid argument for {self.config.name}")
|
567 |
|
568 |
+
with open(file_path, "r", encoding="utf-8") as rf:
|
569 |
json_data = json.load(rf)
|
570 |
|
571 |
for json_dict in json_data["data"]:
|