foiaghost/examples/fruits.py

29 lines
646 B
Python
Raw Normal View History

2023-05-08 03:55:02 +00:00
from beakers.recipe import Recipe
recipe = Recipe("example01")
words_beaker = recipe.add_beaker("words", temp=True)
recipe.add_beaker("fruits")
recipe.add_beaker("other")
recipe.add_beaker("sentences")
recipe.add_conditional(
"words",
lambda x: x["word"]
in (
"apple",
"banana",
"fig",
"grape",
"lemon",
"mango",
"orange",
"pear",
"raspberry",
),
"fruits",
"other",
)
recipe.add_transform("fruits", "sentences", lambda x: f"I like to eat {x['word']}")
recipe.add_transform(
"other", "sentences", lambda x: f"I'm not so sure about {x['word']}"
)