コード例 #1
0
 def testEqualitySimpleKitchenState(self):
     ingList = [("1/2 cup flour", kitchenState.Ingredient(contains=["flour"], homogenous=True,
                                                          amount="1/2 cup", physicalObject=PhysicalObject(prism_from_point(3, 1, 1, 2),
                                                                                                          lcmId = 5, tags=['Flour'])))]
     instList = [("Mix flour into mixing bowl", "pour(flour), mix(flour)")]
     a = annotatedRecipe.AnnotatedRecipe("Temp Name", "Temp Source", ingList, instList).start_state
     b = annotatedRecipe.AnnotatedRecipe("Temp Name", "Temp Source", ingList, instList).start_state
     self.assertTrue(a == b)
コード例 #2
0
 def testAnnotatedRecipeIdxToAnnotation(self):
     ingList = [("1/2 cup flour", kitchenState.Ingredient(contains=["flour"], homogenous=True,
                                                          amount="1/2 cup", physicalObject=PhysicalObject(prism_from_point(3, 1, 1, 2),
                                                                                                          lcmId = 5, tags=['Flour'])))]
     instList = [("Mix flour into mixing bowl", "pour(flour), mix(flour)")]
     a = annotatedRecipe.AnnotatedRecipe("Temp Name", "Temp Source", ingList, instList)
     self.assertEqual(a.idx_to_annotation(0), "pour(flour), mix(flour)")
コード例 #3
0
 def testAnnotatedRecipeName(self):
     ingList = [("1/2 cup flour", kitchenState.Ingredient(contains=["flour"], homogenous=True,
                                                          amount="1/2 cup", physicalObject=PhysicalObject(prism_from_point(3, 1, 1, 2),
                                                                                                          lcmId = 5, tags=['Flour'])))]
     instList = [("Mix flour into mixing bowl", "pour(flour), mix(flour)")]
     a = annotatedRecipe.AnnotatedRecipe("Temp Name", "Temp Source", ingList, instList)
     #print "\n", a.recipe
     expectedOutput = "Temp Name\nTemp Source\n1/2 cup flour\nMix flour into mixing bowl\n"
     self.assertEqual(a.recipe_text, expectedOutput)
コード例 #4
0
    def dest_viterbi_simple(self):
        model_fname = "kitchenModel_1.5.pck"
        training_set = pickle_util.load("training.pck")
        rm = recipeManager.RecipeManager(model_fname)

        ingList = [("1/2 cup flour", kitchenState.Ingredient(contains=["flour"], homogenous=True,
                                                             amount="1/2 cup", physicalObject=PhysicalObject(prism_from_point(3, 1, 1, 2),
                                                                                                             lcmId = 5, tags=['Flour'])))]
        instList = [("Mix flour into mixing bowl.", "pour(flour), mix(flour)"),
                    ("Preheat the oven to 350 F.", "preheat(350)"),
                    ("Bake at 350 F for 30 minutes.", "bake(30)")]
        ar = annotatedRecipe.AnnotatedRecipe("Temp Name", "Temp Source", ingList, instList)
        rm.find_viterbi_plan(ar.instruction_text, ar.start_state)
コード例 #5
0
                             homogenous=True,
                             amount="1/2 cup",
                             physicalObject=PhysicalObject(
                                 kitchenState.prism_from_point(5, 3, 1, 2),
                                 lcmId=2,
                                 tags=['oil']))),
    ("1 cup semisweet chocholate chips",
     kitchenState.Ingredient(contains=["chocolate_chips"],
                             homogenous=True,
                             amount="1 cup",
                             physicalObject=PhysicalObject(
                                 kitchenState.prism_from_point(5, 3, 1, 2),
                                 lcmId=5,
                                 tags=['chocolatechips'])))
]

instructionsList = [
    ("1. Preheat oven to 350 degrees F (175 degrees C).", "preheat(350)"),
    ("2. In a medium bowl, stir together the cake mix and baking powder.",
     "pour(cake_mix), pour(baking_powder), mix()"),
    ("Add eggs and oil, then mix until well blended.",
     "pour(eggs), pour(oil), mix()"),
    ("Stir in chocolate chips, or your choice of additions..",
     "pour(chocolate_chips), mix()"),
    ("Drop by rounded spoonfuls onto cookie sheets.", "scrape()"),
    ("Bake for 8 to 10 minutes in the preheated oven.", "bake(8)")
]

annotatedRecipeObject = annotatedRecipe.AnnotatedRecipe(
    recipeName, recipeSource, ingredientsList, instructionsList)