Rescale an ingredient list
scale_ingredientsRescale English ingredient lists to a target number of servings or a scaling factor, adjusting units and counts for practical cooking.
Instructions
Rescale a list of English ingredient lines. This contacts no website and works on a list from anywhere, including one the user pasted in. Give either 'factor' directly, or 'from_servings' and 'to_servings' and the factor is computed. Grams, millilitres, ounces and pounds are multiplied and rounded to what a scale can show; a quantity that would fall below one is moved to a smaller unit first, so it never rounds away to nothing. Countable things land where a kitchen can follow: an egg, a yolk or a white on a whole one, a clove or a spoon on a half, which is what stops an answer like '2.4 eggs'. An approximate measure is scaled as a count, so a pinch taken from 6 servings to 25 is 4 pinches; the note gives the everyday equivalence, and the quantity stays in the unit the line used. That covers the gestures, such as a pinch, a dash, a glug or a handful, and anything named after what holds it, such as a capful or a spoonful. A line with no quantity at all comes back untouched and flagged. A bracketed equivalent, as in '450 g (1 pound)', is scaled with the amount it restates rather than left to contradict it, and so is one written after a slash, as in '500 g / 1.1 lb'. A line offering a choice, as in '2 tablespoons butter OR 30 g margarine', has both branches scaled, so whichever one the cook takes carries the same share. Prefer this over doing the arithmetic yourself.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| factor | No | Multiplier to apply. Use this or the from/to pair. | |
| ingredients | Yes | Ingredient lines, for example ['450 g (1 pound) spaghetti', '5 egg yolks', 'Salt']. | |
| to_servings | No | How many servings are wanted. | |
| from_servings | No | How many servings the list is written for. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | Yes | ||
| factor | Yes | ||
| ingredients | Yes | ||
| scaled_count | Yes | Lines whose arithmetic came out exact. | |
| rounded_count | Yes | Lines whose value was moved to stay usable, not lines that could have been. | |
| unscaled_count | Yes | Lines carrying nothing that can be multiplied. |