import re

dictionary = {
    "salad dressing": [r"salad dressing$"],
    "vinaigrette": [r"vinaigrette"],
    "wine vinegar": [r"wine vinegar"],
    "cider vinegar": [r"cider vinegar"],
    "balsamic vinegar": [r"balsamic vinegar"],
    "rice vinegar": [r"rice vinegar$"],
    "vinegar": [r"vinegar$"],
    "rice": [
        r"\brice$",
        r"\bgrain$",
        r"\barborio$",
        r"\bbasmati$",
        r"\bbaldo$",
        r"carnarolli$",
        r"maratelli$",
        r"vialone nano",
    ],
    "couscous": [r"couscous$"],
    "oil": [r" oil$", r"oil spray"],
    "gravy": [r" gravy$"],
    "bone": [r" bones?$"],
    "jalapeno": [r"^jalapeno($| pepper$)"],
    "ghee": [r"ghee"],
    "nut butter": [r"(nut|cashew|almond).*butter$"],
    "butter": [r"butter margarine", r"margarine", r"butter$"],
    "water": [
        r"(cold |hot |warm |\bice |soda |tap |seltzer |cool |pasta |salt |lukewarm |^)water$"
    ],
    "egg": [r"(?<!chocolate )\beggs?$"],
    "tomato": [r" tomato$"],
    "potato": [r" potato$"],
    "masala": [r"masala"],
    "dark chocolate": [r"dark chocolate"],
    "white chocolate": [r"white chocolate"],
    "chocolate": [r"chocolate baking square", r"chocolate$", r"chocolate square"],
    "wonton wrapper": ["spring wrapper"],
    "citrus liqueur": ["limoncello", "orange liqueur", "margarita mix"],
    "fruit liqueur": ["amaretto", "curacao"],
    "liqueur": [
        r"rumchata",
        r"\brum$",
        r"liqueur$",
        r"liquor$",
        "creme de cacao",
        "frangelico",
        r"rum$",
        "amarula cream liqueur",
        "ouzo",
        "kirsch",
        r"bourbon&",
        r"^gin&",
        "kahlua",
        "grand marnier",
        "cognac",
        "triple sec",
        "vodka",
        "tequila",
        "brandy",
        r"bitters?$",
    ],
    "grain mustard": [r"grainy mustard$"],
    "dijon mustard": [r"dijon mustard$"],
    "mustard": [r"mustard$"],
    "olive": [r"\bolive$"],
    "fortified wine": [
        r"marsala(?: wine)?$",
        r"madeira wine$",
        r"port wine$",
        r"mistell?a wine",
        r"\bport$",
        "vermouth",
        r"sherry wine$",
        r"sherry$",
    ],
    "rice wine": [
        r"shaoxing wine$",
        r"rice wine$",
        "cooking wine",
        r"^sake$",
        r"chinese wine$",
    ],
    "wine": [r"\bwine"],
    "spicy pepper": [
        "chipotle chile",
        r"chill?[iey]( pepper)?$",
        r"hot pepper$",
        "serrano( pepper)?$",
        "poblano( pepper)?$",
        "scotch bonnet( pepper)?$",
        "habanero( pepper)?$",
        "chipotle( pepper)?$",
        "pepperoncini( pepper)?$",
        "banana pepper$",
        "anaheim chili",
        r"pimi?ento( pepper)?$",
        r"\bchile$",
        r"\bchilly$",
        r"\bchili$",
    ],
    "bell pepper": ["green pepper", "yellow pepper", "capsicum", r"bell pepper$"],
    "scallion": [r"green onion$", r"spring onion$", r"scallion$"],
    "pearl onion": [
        r"pearl onion$",
        r"baby onion$",
        r"pickling onion$",
        r"cocktail onion$",
    ],
    "onion": [r"onion$"],
    "whiskey": [r"whisky$", r"whiskey$"],
    "cider": [r"cider$"],
    "food coloring": [r"coloring$"],
    "beer": [r"\bbeer$", r"\bale$", r"\bstout$"],
    "sugar": ["sugar substitute", "jaggery", "sweetener", "splenda", r"\bsugar$"],
    "corn": [
        "ear corn",
        "mexican corn",
        "sweetcorn",
        "mexicorn",
        "corn cob",
        "white corn",
        "kernel",
    ],
    "egg white": ["egg beater substitute"],
    "avocado": ["avocado"],
    "yogurt": [r"yogh?urt"],
    "foil": [r"foil$"],
    "bulgur": [r"bulg[au]r wheat", r"bulg[au]r$"],
    "wasabi": ["wasabi"],
    "pineapple": [
        r"pineapple rings?",
        r"pineapple$",
        r"pineapple tidbits?",
        r"pineapple chunks?",
    ],
    "pepper": [r"pepper powder$"],
    "coffee": [r"black cofee$", "espresso", r"coffee$"],
    "coffee powder": ["espresso powder", "coffee granule"],
    "miso": [r"\bmiso$"],
    "celery": [r"celery(?: sticks?| roots?)?$"],
    "arugula": [r"arug[ua]la", r"roquette$", r"rocket", r"rucola"],
    "syrup": [r"syrup$", r"nectar$"],
    "shortening": ["shortening", "crisco"],
    "cracker": [r"cracker$", r"matzo meal", r"matzo"],
    "molasses": ["molasses"],
    "salsa": [r"salsa$", "rotel tomato chilies", r"^rotel"],
    "garlic powder": ["garlic granule"],
    "garlic head": ["head garlic", "bulb garlic"],
    "fat": [r"\bsuet$", r"\bgrease$", r"\bdripping$", r"\blard$", r"\bfat$"],
    "yeast": [r"yeast$"],
    "italian seasoning": [
        "italian spice",
        "italian herb",
        r"italian.*seasoning",
    ],
    "za'atar seasoning": [r"za'?atar"],
    "dressing": [r"dressing(?: mix)?"],
    "msg": ["accent seasoning"],
    "coconut cream": ["cream coconut"],
    "coconut": [r"coconut$", r"coconut meat"],
    "mayonnaise": ["miracle whip", r"mayo$", r"mayonnaise$"],
    "hominy": [r"hominy$"],
    "mascarpone": ["mascarpone"],
    "bisquick": ["bisquick"],
    "lemon pepper": ["lemon[- ]?pepper"],
    "bread roll": [
        r"^french$",
        r"^crescent$",
        r"^kaiser$",
        r"hoagie",
        r"crescent dinner",
        r"french baguette",
        r"baguette",
    ],
    "bok choy": ["bok choy", "pak choi"],
    "bouillon cube": ["buillon cube", "buillon granule", "stock cube"],
    "tortilla": [r"tortilla$", "egg wrap"],
    "salami": [r"salami$", r"pepperoni$"],
    "flower water": ["flower water", "rose water"],
    "sweet potato": ["yam", "sweet potato", "kumara"],
    "pita bread": ["pita bread"],
    "heavy cream": [
        r"double cream$",
        r"whipping cream",
        r"^cream$",
        r"half cream",
        r"nonfat cream",
        r"single cream",
    ],
    "irish cream": [r"irish cream", r"bailey's"],
    "bread": [r"bread$", "ciabatta"],
    "cooking spray": ["cooking spray"],
    "liquid smoke": ["liquid smoke"],
    "milk": [r"\bmilk$"],
    "milk powder": [r"milk powder", "powdered milk"],
    "tofu": [r"tofu$"],
    "pickle": [r"pickle$", "gherkin"],
    "skewer": [r"skewer$"],
    "broccoli": [r"broccoli$"],
    "eggplant": ["aubergine"],
    "zucchini": ["courgette", r"zucchinis?"],
    "honey": [r"honey$"],
    "saffron": ["saffron"],
    "sweet sour mix": [r"^mix$"],
    "chili flake": [r"chili flake$", r"pepper flake$"],
    "mango chutney": [r"chutney$"],
    "tortilla chip": ["tortilla chip", "corn chip"],
    "all-purpose flour": ["masa harina"],
    "pecan": ["pecan"],
    "whipped cream": ["cool whip"],
    "breadcrumb": [r"breadcrumb$", "bread crumb"],
    "pesto": ["pesto"],
    "ketchup": [r"ketchup$", "catsup"],
    "oat": [r"\boat$"],
    "pistachio": [r"pistachio"],
    "soy milk": ["soymilk"],
    "kiwi": ["kiwi fruit"],
    "asparagus": ["asparagus spear"],
    "barley": ["pearl barley"],
    "starch": [r"starch$", "cornstarch", "pectin"],
    "maraschino cherry": ["glace cherry"],
    "phyllo pastry": ["phyllo dough"],
    "cornmeal": ["cornmeal"],
    "spinach": ["spinach leaf"],
    "vanilla extract": ["vanilla essence", r"^vanilla$"],
    "vanilla bean": ["vanilla pod"],
    "raisin": ["sultana"],
    "sour cream": ["creme fraiche", "sour cream"],
    "pie crust": ["pie shell", "crust pie"],
    "vanilla ice cream": ["ice cream"],
    "lettuce": ["lettuce leaf", "leaf lettuce"],
    "cream of tartar": ["cream tartar"],
    "beet": ["beetroot"],
    "ice": [r"ice cube", r"\bice$"],
    "cocoa": ["cocoa powder"],
    "cauliflower": [r"^cauliflower"],
    "lemongrass": ["lemon grass", "lemongrass"],
    "artichoke": ["artichoke(?: hearts?)?$"],
    # ROOTS
    "jicama": ["jicama"],
    "sunchoke": ["sunchoke"],
    "ginger": [
        "gingerroot",
        "ginger root",
        "ginger paste",
        "ginger powder",
        "root ginger",
    ],
    "turmeric": ["turmeric powder", "turmeric"],
    # HERBS
    "mint": ["mint leaf", r"mint$"],
    "basil": ["basil leaf", r"\bbasil$"],
    "cilantro": [r"cilantro$", r"coriander(?: cress)?$"],
    "dill": ["dill weed", r"dill$"],
    "oregano": ["oregano"],
    "thyme": ["thyme leaf", "thyme leave", r"thyme$"],
    "parsley": [r"parsley$", "parsley leaf", "parsley flake"],
    "rosemary": ["rosemary leaf", r"rosemary$"],
    "fenugreek": ["fenugreek$", "fenugreek leaf"],
    # LEGUMES
    "brussel sprout": [r"brussels? sprouts?"],
    "vanilla bean": [r"^vanilla beans?$"],
    "coffee bean": [r"\bcoffee beans?\b", r"espresso bean"],
    "sprout": [r"\bsprouts?\b"],
    "lentil": [r"\blentil(s?| bean)$"],
    "pea": [r"^snow$", r"\bpea(s?| bean)$"],
    "dal": [
        r"\bchann?a\b",
        r"\bur[ai]d\b",
        r"\btoor\b",
        r"\bdhal$",
        r"\bdal$",
        r"\bpulse$",
    ],
    "edamame": [r"\bsoy beans?$", r"\bedamame(s?| bean)$"],
    "chickpea": [r"\bchickpeas?$", r"\bbengal\b", r"\bgarbanzo\b"],
    "bean": [r"\brajma\b", r"\bbeans?$", r"bean kidney", r"\bcannellini(s?| bean)$"],
    # MUSHROOMS
    "morel mushroom": [r"\bmorels?\b"],
    "cremini mushroom": [
        "button mushroom",
        "cremini",
        r"baby port[oa]bell[oa]",
        r"chestnut.*mushroom",
        "baby bella",
        r"brown.*mushroom",
        "crimini",
    ],
    "chanterelle mushroom": [r"chante?relle"],
    "black mushroom": [r"black.*mushroom"],
    "enoki mushroom": ["enoki", "beech", "shimeji"],
    "oyster mushroom": ["oyster", r"trumpet.*mushroom"],
    "shiitake mushroom": ["shiitake", "chinese.*mushroom", "japanese.*mushroom"],
    "porcini mushroom": ["porcini", "bolet", "king mushroom"],
    "champignon mushroom": [
        "field mushroom",
        r"port[ao]bell[ao]",
        "straw mushroom",
        "large mushroom",
        "champignon",
    ],
    "mushroom": [r"mushroom$", "mushroom cap", "mushroom stem"],
    # PASTA
    "pasta": [
        "rigatoni",
        "rotini",
        "ziti",
        "pasta shell",
        "vermicelli",
        "pasta shell",
        "gnocchi",
        "manicotti",
        "noodle",
        "noodles",
        "spaghetti",
        "penne",
        "pappardelle",
        "orecchiette",
        "macaroni",
        "linguine",
        "farfalle",
        "fusilli",
        "fettuccine",
        "capellini",
        "lasagna",
        "angel hair",
        r"dital[io]ni",
        r"paccheri",
        r"tort[ei]glioni",
        "cavatelli",
        r"conchiglie",
        "orzo",
        "ravioli",
        "tortellini",
        r" pasta$",
    ],
    # FLOUR
    "wheat flour": [
        r"whole[ -]?(meal|wheat) flour",
        # grain flours
        r"graham flour",
        r"teff flour",
        "oat flour",
        "buckwheat flour",
        "quinoa flour",
        "rye flour",
        "spelt flour",
        "sorghum flour",
        "chickpea flour",
        "gram flour",
        # white grain flours
        "masa harina",
        "amaranth flour",
        "barley flour",
        "rice flour",
        "millet flour",
        "corn flour",
        "potato flour",
    ],
    "flour": [r" flour$"],
    # CHEESE
    "monterey jack cheese": ["monterey jack"],
    "mexican cheese": ["queso fresco", "mexican cheese$"],
    "feta cheese": [r"\bfeta$"],
    "mozzarella cheese": [r"mozzarella", r"stracciatella$", r"stracciatella cheese"],
    "pecorino cheese": ["pecorino"],
    "ricotta cheese": ["ricotta"],
    "gruyere cheese": ["gruyere"],
    "cottage cheese": ["cottage cheese", r"cottage$"],
    "pepper jack cheese": [r"pepper jack"],
    "cream cheese": [r"cream cheese$"],
    "cheddar cheese": [r"cheddar cheese$", r"cheddar$", "caerphilly"],
    "parmesan cheese": ["parmigiano", "parmesan", "grana? padano"],
    "cheese": ["cheese$"],
    # STOCKS
    "chicken stock": [
        "chicken stock",
        "chicken broth",
        "chicken bouillon",
        "chicken granule",
    ],
    "vegetable stock": [
        r"(?:vegetable|veggie) stock",
        r"(?:vegetable|veggie) broth",
        r"(?:vegetable|veggie) bouillon",
        r"(?:vegetable|veggie) granule",
    ],
    "beef stock": [r"beef (stock|broth|bouillon|granule|juice|consomme|veloute)"],
    "fish stock": [
        r"(fish|seafood|crab|mussel) (stock|broth|bouillon|granule|juice|consomme|veloute)"
    ],
    "pork stock": [r"pork (stock|broth|bouillon|granule|juice|consomme|veloute)"],
    "stock": [r"(stock|broth|bouillon|granule|consomme|veloute)$"],
    # SAUCES
    "adobo sauce": ["chipotle pepper adobo sauce"],
    "soy sauce": ["ketjap manis", r"soya? sauce", r"tamari$", r"tamari sauce"],
    "tomato sauce": [r"tomato sauce$", "tomato puree"],
    "fish sauce": [r"nam pla", r"fish sauce", r"seafood sauce"],
    "enchilada sauce": ["enchilada sauce"],
    "hot sauce": ["sriracha", "adobo sauce", "hot sauce"],
    "pepper sauce": [r"pepper.*sauce$"],
    "garlic paste": [r"garlic paste"],
    "chili paste": [
        r"chill?i?[iey].*paste",
        r"adobo.*(?:paste|sauce)",
        r"ranchero.*sauce",
    ],
    "curry paste": [r"curry.*paste"],
    "tomato paste": [r"tomato.*paste"],
    # SPICES
    "salt": [r"\bsalt(?:.*pepper)?$", r"\bsalt$", r"sea-salt$"],
    "garlic": [r"garlic$", "garlic bulb", "garlic clove"],
    "masala": [r"masala"],
    "mustard powder": ["mustard powder"],
    "coriander powder": ["coriander powder"],
    "fivespice": ["fivespice"],
    "spicy powder": [
        "cayenne",
        r"chill?[iey] powder",
        r"(?:chipotle|habanero|poblano|pepperoncino).*powder",
    ],
    "curry powder": [r"curry.*powder"],
    "cardamom": ["cardamom powder", r"cardamom$"],
    "cumin": [
        r"cumin( powder)?$",
        r"jeera( powder)?$",
        r"nigella seed",
        r"caraway( seed)?$",
    ],
    "peppercorn": [r"peppercorn$"],
    "sichuan pepper": [
        r"(whole)?sz?[ei]ch[uw]an pepper(corn)?",
    ],
    # NUTS
    "cashew": [r"\bcashew( nut)?$"],
    "chestnut": [r"chest ?nut$"],
    "walnut": [r"walnut( hal(f|ves))?$"],
    "peanut": [r"peanut$"],
    "almond": [r"almond$", r"macadamia(?: nut)?$"],
    "pistachio": [r"pistachio(?: nut)?$"],
    "pecan": [r"pecan(?: nut)?$"],
    "hazelnut": [r"hazel ?nut$"],
    "nut": [r"\bnut$", r"sacha inchi", r"acorns?$", r"butternuts?$"],
    # SEEDS
    "chia": ["chia( seed)?"],
    "anise": ["anise( seed)?"],
    "cardamom pod": ["cardamom pod", "cardamom seed"],
    "mustard seed": [r"mustard seed$"],
    "sesame": [r"sesame seeds?", r"sesame$"],
    "poppy": [r"poppy seeds?", r"poppy$"],
    "sunflower seed": [r"sunflower seed"],
    "seed": [r"\bseed$"],
    # VEGETABLES
    "spinach": [r"spinach$"],
    "kale": [r"\bkale$"],
}


class Ingredient:
    def __init__(self, phrase):
        self.category = []
        self.quantity = []
        self.name = ""
        self.unit = ""


def get_cheese():
    return [key for key in list(dictionary.keys()) if re.search(r"\bcheese$")]
