Skip to content
Permalink
2c766c40e9
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
24 lines (20 sloc) 946 Bytes
# Made by Andris Jansons
KEYWORDS = "the, a, an, get, good, best, is, are, to, nice, pleasant, lovely, cool, fine, stupid, goddamn, great, large, small, medium, new, newest, old, closest, smallest, biggest, coolest".split(", ")
def findFood(text):
"""Finds food after special KEYWORDS"""
found = False
food = ""
for word in text:
if found == False:
if word == "get":
continue
if word in KEYWORDS:
found = True #Finds the first keyword
food = word
else:
if word in KEYWORDS:
food = food + " " + word
continue
food = food + " " + word #If multiple keywords follow each other
break # take all of them in account and the word
return food # that follows them as well e.g. "The best burger"