Fix data preparation
Browse files
src/preparaing_recipe_nlg_dataset.py
CHANGED
@@ -92,13 +92,14 @@ def main():
|
|
92 |
ingredients = item_dict["ingredients"]
|
93 |
steps = item_dict["directions"]
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
102 |
return None
|
103 |
|
104 |
ner = ", ".join(ner)
|
|
|
92 |
ingredients = item_dict["ingredients"]
|
93 |
steps = item_dict["directions"]
|
94 |
|
95 |
+
conditions = []
|
96 |
+
conditions += filter_by_item(ner, 2)
|
97 |
+
conditions += filter_by_length(title, 4)
|
98 |
+
conditions += filter_by_item(ingredients, 2)
|
99 |
+
conditions += filter_by_item(steps, 2)
|
100 |
+
# conditions += filter_by_steps(" ".join(steps))
|
101 |
+
|
102 |
+
if not all(conditions):
|
103 |
return None
|
104 |
|
105 |
ner = ", ".join(ner)
|