def main(): ## train_for(['alter', 'Rum and Coke', 'alcoholic'], ['command_training.csv', 'drink_training.csv', 'flavor_training.csv']) #make me a <drink> ## train_many('make', drinks = create_presets.getdrinks()) #make me a <flavor> drink ## train_many('make', flavors = Ingredient.flavorlist()) #make me a <flavor> <drink> train_many('make', drinks = create_presets.getdrinks(), flavors = Ingredient.flavorlist())
def _calcflavorlevels(self): """Calculates the drink's value for each flavor """ ingredients = self.ingredients #find the current level of each flavor for flavor in Ingredient.flavorlist(): level = 0 for ingredient, num_parts in ingredients.iteritems(): level += ingredient.flavorvalue(flavor) * num_parts level /= self.total_parts self.levels[flavor] = level