Example #1
0
import recipegenerator as recipe
import scrapeurl as allurl
from difflib import SequenceMatcher
import nltk
import collections

allingred = []
allcm = []

chinese = allurl.chineseurl()
for i in chinese:
    myrecipe = recipe.returnRecipe(i)
    allcm = allcm + myrecipe['cooking method']
    tempingred = myrecipe['ingredients']
    for j in tempingred:
        allingred.append(j["measurement"])
print("-------------top measurement")
ti = collections.Counter(allingred)
ltopi = len(ti)
Topi = ti.most_common(ltopi)
print(Topi)
print("-------------top method")

tcm = collections.Counter(allcm)
ltopcm = len(tcm)
Topcm = tcm.most_common(ltopcm)

print(Topcm)
'''

print("-----------------top vegan description")
Example #2
0





'''

##############################################test transform
url = input("Please input URL(type a space in the end then enter): ")
print("You want to transform recipe url is :" + url)
url = url.strip()
if (url == ""):
    print("You didn't enter anything, using the default link...")
    url = "https://www.allrecipes.com/recipe/220125/slow-cooker-beef-pot-roast/?clickId=right%20rail0&internalSource=rr_feed_recipe_sb&referringId=237320%20referringContentType%3Drecipe"
myrecipe = recipe.returnRecipe(url)
print("-----------previous recipe")
oldrecipe = copy.deepcopy(myrecipe)
print(myrecipe)
cm = myrecipe['cooking method']
ingred = myrecipe['ingredients']
#direct=myrecipe['step']
ct = myrecipe['cooking tools']
namelist = []
for i in range(len(cm)):
    for j in range(len(chinese_method_mapping_from)):
        if (cm[i] in chinese_method_mapping_from[j]
                and chinese_method_mapping_to[j] not in cm):
            cm[i] = chinese_method_mapping_to[j]
myrecipe['cooking method'] = cm
for i in range(len(ct)):