Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# Made by Andris Jansons
KEYWORDS = "the, a, an, get, good, best, is, are, to, nice, pleasant, lovely, cool, fine, stupid, goddamn, nearest, great, large, small, medium, new, newest, old, closest, smallest, biggest, coolest".split(", ")
SKIPS = "get, is, are, to".split(", ")
def findFood(text):
"""Finds food after special KEYWORDS"""
found = False
food = ""
for word in text:
if found == False:
if word in KEYWORDS:
found = True #Finds the first keyword
if not(word in SKIPS):
food = word
else:
if word in KEYWORDS:
if not(word in SKIPS):
food = food + " " + word
continue
food = food + " " + word #If multiple keywords follow each other
break # take all of them in account and the word
# that follows them as well e.g. "The best burger"
food = food.strip(' ') # Make the string neat for printing it out
return food