Adding general and specific comments to Source A
Browse files- aes_enem_dataset.py +6 -2
aes_enem_dataset.py
CHANGED
@@ -142,6 +142,8 @@ class AesEnemDataset(datasets.GeneratorBasedBuilder):
|
|
142 |
"essay_text": datasets.Value("string"),
|
143 |
"grades": datasets.Sequence(datasets.Value("int16")),
|
144 |
"essay_year": datasets.Value("int16"),
|
|
|
|
|
145 |
}
|
146 |
)
|
147 |
|
@@ -286,7 +288,6 @@ class AesEnemDataset(datasets.GeneratorBasedBuilder):
|
|
286 |
|
287 |
grader_a = pd.read_csv(f"{dirname}/GraderA.csv")
|
288 |
grader_b = pd.read_csv(f"{dirname}/GraderB.csv")
|
289 |
-
|
290 |
for grader in [grader_a, grader_b]:
|
291 |
grader.grades = grader.grades.apply(lambda x: x.strip("[]").split(", "))
|
292 |
grader.grades = grader.grades.apply(map_list)
|
@@ -393,6 +394,7 @@ class AesEnemDataset(datasets.GeneratorBasedBuilder):
|
|
393 |
assert (
|
394 |
len(set(val_df["id_prompt"]).intersection(set(test_df["id_prompt"]))) == 0
|
395 |
), "Overlap between val and test id_prompt"
|
|
|
396 |
train_df.to_csv(f"{dirname}/train.csv", index=False)
|
397 |
val_df.to_csv(f"{dirname}/validation.csv", index=False)
|
398 |
test_df.to_csv(f"{dirname}/test.csv", index=False)
|
@@ -415,6 +417,8 @@ class AesEnemDataset(datasets.GeneratorBasedBuilder):
|
|
415 |
"essay_text": row["essay"],
|
416 |
"grades": grades,
|
417 |
"essay_year": row["essay_year"],
|
|
|
|
|
418 |
}
|
419 |
|
420 |
|
@@ -585,7 +589,7 @@ class HTMLParser:
|
|
585 |
for span in soup.find_all("span"):
|
586 |
span.decompose()
|
587 |
result = table.find_all("p")
|
588 |
-
result = "
|
589 |
[paragraph.get_text().strip() for paragraph in result]
|
590 |
)
|
591 |
return result
|
|
|
142 |
"essay_text": datasets.Value("string"),
|
143 |
"grades": datasets.Sequence(datasets.Value("int16")),
|
144 |
"essay_year": datasets.Value("int16"),
|
145 |
+
"general_comment": datasets.Value("string"),
|
146 |
+
"specific_comment": datasets.Value("string"),
|
147 |
}
|
148 |
)
|
149 |
|
|
|
288 |
|
289 |
grader_a = pd.read_csv(f"{dirname}/GraderA.csv")
|
290 |
grader_b = pd.read_csv(f"{dirname}/GraderB.csv")
|
|
|
291 |
for grader in [grader_a, grader_b]:
|
292 |
grader.grades = grader.grades.apply(lambda x: x.strip("[]").split(", "))
|
293 |
grader.grades = grader.grades.apply(map_list)
|
|
|
394 |
assert (
|
395 |
len(set(val_df["id_prompt"]).intersection(set(test_df["id_prompt"]))) == 0
|
396 |
), "Overlap between val and test id_prompt"
|
397 |
+
#train_df['essay_year'] = train_df['essay_year'].astype(int)
|
398 |
train_df.to_csv(f"{dirname}/train.csv", index=False)
|
399 |
val_df.to_csv(f"{dirname}/validation.csv", index=False)
|
400 |
test_df.to_csv(f"{dirname}/test.csv", index=False)
|
|
|
417 |
"essay_text": row["essay"],
|
418 |
"grades": grades,
|
419 |
"essay_year": row["essay_year"],
|
420 |
+
"general_comment": row["general"],
|
421 |
+
"specific_comment": row["specific"],
|
422 |
}
|
423 |
|
424 |
|
|
|
589 |
for span in soup.find_all("span"):
|
590 |
span.decompose()
|
591 |
result = table.find_all("p")
|
592 |
+
result = " ".join(
|
593 |
[paragraph.get_text().strip() for paragraph in result]
|
594 |
)
|
595 |
return result
|