Update Fin-Fact.py
Browse files- Fin-Fact.py +0 -9
Fin-Fact.py
CHANGED
|
@@ -46,7 +46,6 @@ class FinFact(datasets.GeneratorBasedBuilder):
|
|
| 46 |
"claim": datasets.Value("string"),
|
| 47 |
"author": datasets.Value("string"),
|
| 48 |
"posted": datasets.Value("string"),
|
| 49 |
-
"justification": datasets.Sequence(datasets.Value("string")),
|
| 50 |
"label": datasets.Value("string"),
|
| 51 |
}
|
| 52 |
),
|
|
@@ -71,18 +70,10 @@ class FinFact(datasets.GeneratorBasedBuilder):
|
|
| 71 |
with open(filepath, encoding="utf-8") as f:
|
| 72 |
data = json.load(f)
|
| 73 |
for id_, row in enumerate(data):
|
| 74 |
-
justification = row.get("justification", "")
|
| 75 |
-
# Ensure justification is always a list
|
| 76 |
-
if isinstance(justification, str):
|
| 77 |
-
justification = [justification]
|
| 78 |
-
elif not isinstance(justification, list):
|
| 79 |
-
justification = []
|
| 80 |
-
|
| 81 |
yield id_, {
|
| 82 |
"url": row.get("url", ""),
|
| 83 |
"claim": row.get("claim", ""),
|
| 84 |
"author": row.get("author", ""),
|
| 85 |
"posted": row.get("posted", ""),
|
| 86 |
-
"justification": justification,
|
| 87 |
"label": row.get("label", ""),
|
| 88 |
}
|
|
|
|
| 46 |
"claim": datasets.Value("string"),
|
| 47 |
"author": datasets.Value("string"),
|
| 48 |
"posted": datasets.Value("string"),
|
|
|
|
| 49 |
"label": datasets.Value("string"),
|
| 50 |
}
|
| 51 |
),
|
|
|
|
| 70 |
with open(filepath, encoding="utf-8") as f:
|
| 71 |
data = json.load(f)
|
| 72 |
for id_, row in enumerate(data):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
yield id_, {
|
| 74 |
"url": row.get("url", ""),
|
| 75 |
"claim": row.get("claim", ""),
|
| 76 |
"author": row.get("author", ""),
|
| 77 |
"posted": row.get("posted", ""),
|
|
|
|
| 78 |
"label": row.get("label", ""),
|
| 79 |
}
|