29 lines
646 B
Python
29 lines
646 B
Python
|
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']}"
|
||
|
)
|