Exemplo n.º 1
0
def main():
    training_set = pickle_util.load("training.pck")
    arc = annotatedRecipe.Corpus(training_set=training_set)
    recipeCorpus = arc.recipes
    for i in recipeCorpus:
        if i.is_training_set == False:
            print i.name
Exemplo n.º 2
0
def main():
    training_set = pickle_util.load("training.pck")
    totalRecipes = 0
    totalIngredients = 0
    ingredientsList = []
    arc = annotatedRecipe.Corpus(training_set=training_set)
    recipeCorpus = arc.recipes
    for i in recipeCorpus:
        totalRecipes += 1
        for j in i.ingredients:
            if j[1].contains[0] == "onion":
                print i.name
            if j[1].contains[0] not in ingredientsList:
                ingredientsList.append(j[1].contains[0])
            totalIngredients += 1
    ingredientsList.sort()
    print "\n\n\n"
    print "Total Recipes:", totalRecipes
    print "Total Ingredients", totalIngredients
    print "Ingredient List:", ingredientsList
    print "\n\n\n"
    return 1
Exemplo n.º 3
0
def runInstructionEvaluation(runTestSet=True):
    training_set = pickle_util.load("training.pck")
    totalRecipes = 0
    arc = annotatedRecipe.Corpus(training_set=training_set)
    recipeCorpus = arc.recipes
    ev = Evaluator()
    for i in recipeCorpus:
        if i.is_training_set == runTestSet:
            continue
        totalRecipes += 1
        ev.evaluateInstructions(i)

    print "\n\nOverall results for the entire instruction-level evaluation."
    print "Total Recipes:", totalRecipes
    print "Total Instructions:", ev.totalCount, "\nSuccess:", ev.successCount
    print "Noop Success:", ev.noopSuccessCount
    print "Failures:", ev.totalCount - (ev.successCount + ev.noopSuccessCount)
    right = ev.successCount + ev.noopSuccessCount
    print "%.3f%% (%d/%d)" % (float(right) / ev.totalCount * 100, right,
                              ev.totalCount)
    print "\n\n"
    return (ev.totalCount, ev.successCount, ev.noopSuccessCount)
Exemplo n.º 4
0
def runEndToEndEvaluation(runTestSet=True):
    training_set = pickle_util.load("training.pck")
    totalRecipes = 0
    arc = annotatedRecipe.Corpus(training_set=training_set)
    recipeCorpus = arc.recipes
    ev = Evaluator()
    for i in recipeCorpus:
        if i.is_training_set == runTestSet:
            continue
        totalRecipes += 1
        result = ev.evaluateEndToEnd(i)
        if result != 0:
            print "Failure 1"
            return 1

    print "\n\nOverall results for the entire end-to-end evaluation."
    print "Total Recipes:", totalRecipes
    print "Success:", ev.successCount
    print "Failures:", ev.totalCount - ev.successCount
    right = ev.successCount + ev.noopSuccessCount
    print "%.3f%% (%d/%d)" % (float(right) / ev.totalCount * 100, right,
                              ev.totalCount)
    print "\n\n"
    return (totalRecipes, ev.successCount)
Exemplo n.º 5
0
 def testAnnotatedRecipeCorpusGlob(self):
     output = annotatedRecipe.Corpus("data/")
     print output.recipes
     print output.recipes[0].recipe_text