Datasets:
Update Yelpdata_663.py
Browse files- Yelpdata_663.py +6 -4
Yelpdata_663.py
CHANGED
|
@@ -114,11 +114,13 @@ class YelpDataset(datasets.GeneratorBasedBuilder):
|
|
| 114 |
]
|
| 115 |
|
| 116 |
def _generate_examples(self, filepath):
|
| 117 |
-
|
| 118 |
logging.info("generating examples from = %s", filepath)
|
| 119 |
with open(filepath, encoding="utf-8") as csv_file:
|
| 120 |
reader = csv.DictReader(csv_file)
|
| 121 |
for i, row in enumerate(reader):
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
| 114 |
]
|
| 115 |
|
| 116 |
def _generate_examples(self, filepath):
|
| 117 |
+
"""This function returns the examples in the raw (text) form."""
|
| 118 |
logging.info("generating examples from = %s", filepath)
|
| 119 |
with open(filepath, encoding="utf-8") as csv_file:
|
| 120 |
reader = csv.DictReader(csv_file)
|
| 121 |
for i, row in enumerate(reader):
|
| 122 |
+
# Convert specific fields to integers from floats
|
| 123 |
+
if 'is_open' in row and row['is_open']:
|
| 124 |
+
row['is_open'] = int(float(row['is_open']))
|
| 125 |
+
# Similarly convert other fields that need preprocessing
|
| 126 |
+
yield i, row
|