added ingred which are always present
water, salt, pepper...
This commit is contained in:
parent
853b749fde
commit
cfd9d0fcc8
8
test.py
8
test.py
|
|
@ -6,6 +6,7 @@ import time
|
||||||
|
|
||||||
dbSession = Session()
|
dbSession = Session()
|
||||||
inputArr = ["butter", "milch", "eier", "mehl", "zucker"]
|
inputArr = ["butter", "milch", "eier", "mehl", "zucker"]
|
||||||
|
inputArr += ["Wasser", "salz", "pfeffer"] # it is assumed that everyone has this
|
||||||
maxMissing = 10
|
maxMissing = 10
|
||||||
|
|
||||||
def slow():
|
def slow():
|
||||||
|
|
@ -85,7 +86,7 @@ def printDict(indx):
|
||||||
outDict[calcOverlay(inputArr, ingred)] = (dbSession.query(Recipe).filter(Recipe.recipe_id==key).first().name, key, dbSession.query(Ingredient.name).filter(Ingredient.recipe_id==key).all())
|
outDict[calcOverlay(inputArr, ingred)] = (dbSession.query(Recipe).filter(Recipe.recipe_id==key).first().name, key, dbSession.query(Ingredient.name).filter(Ingredient.recipe_id==key).all())
|
||||||
|
|
||||||
for key, value in outDict.items():
|
for key, value in outDict.items():
|
||||||
if key >= 0.5:
|
if key >= 0.7:
|
||||||
print(key, value)
|
print(key, value)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -104,13 +105,8 @@ def calcOverlay(l1, l2):
|
||||||
counter +=1
|
counter +=1
|
||||||
counter = counter / len(l2)
|
counter = counter / len(l2)
|
||||||
return counter
|
return counter
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
start = time.time()
|
|
||||||
#slow()
|
|
||||||
end = time.time()
|
|
||||||
print("\n", end - start, "\n")
|
|
||||||
|
|
||||||
stemmed = stemInput(inputArr)
|
stemmed = stemInput(inputArr)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue