Scale an ingredient list
scale_ingredientsRescale French ingredient lists to any number of servings by factor or from/to serving counts. Handles grams, millilitres, countable items, and approximate measures; flags quantity-less lines.
Instructions
Rescale a list of ingredient lines to a different number of servings, without contacting any website. Give either 'factor' directly, or 'from_servings' and 'to_servings' and the factor is computed. Works on any French ingredient list, whatever its source, so it also serves a recipe the user pasted in. Quantities in grams or millilitres are multiplied and rounded to readable values; a countable thing lands on a half when half of one can be poured, weighed or cut, as a boîte, a sachet, a feuille de gélatine or a cuillère can, and on a whole one when it cannot, as an oeuf, a jaune or a blanc; approximate measures such as a pinch or a handful have their count multiplied in whole units and stay in their own vocabulary. A line writing an article where a digit would go, as in 'un bouchon de rhum' or 'une pincée de sel', is read as one of that measure. Lines carrying no quantity are returned untouched and flagged. 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 ['200 g de farine', '3 oeufs', 'sel']. | |
| 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 | ||
| rounded_count | Yes | Lines whose value rounding moved away from the exact product, not lines that could have been rounded. | |
| unscaled_count | Yes |