parse-recipe
v0.1.0
Published
Parse recipe ingredient lines and instruction mentions.
Readme
parse-recipe
This package provides utilities for parsing food recipes, both "ingredient lines" and "instructions lines".
Example usage:
import { readFileSync } from "node:fs";
import { analyzeRecipeInstructions, createLexiconFromText, createParser, ingredientToString } from "parse-recipe";
const lexicon = createLexiconFromText(readFileSync("ingredients-lexicon.txt", 'utf8'));
const parser = createParser({ lexicon });
const result = analyzeRecipeInstructions({
ingredients:
`4 egg yolks (try using the egg whites in Dutch Baby with Egg Whites)
¼ cup sugar
1 cup heavy cream
6 oz dark chocolate or semisweet chocolate chips (1 cup)
1.5 cup heavy cream`.split('\n'),
instructions:
`Chop the dark chocolate quite small (I use a small food processor that was probably meant for spices or coffee).
Beat egg yolks in small bowl with electric mixer on high speed about 3 minutes or until thick and lemon colored.
Gradually beat in sugar.
Heat 1 cup whipping cream in 2-quart saucepan over medium heat until hot. Gradually stir at least half of the hot whipping cream into the bowl with egg yolk mixture (to temper it); stir back into hot cream in saucepan.
Cook over low heat about 5 minutes (or less), stirring constantly, until mixture thickens (do not boil).
Put finely-chopped chocolate into a bowl, ideally one that has a lid so it can go in the fridge to chill.
Gradually add the hot egg mixture (custard) into the chocolate, I add it by quarter cups, stirring well after each addition. The mixture should *not* have oil separated (that means you added the egg too fast) - if it does, the resulting mousse will be less smooth (but still very tasty).
Cover and refrigerate, 2-4 hours.
Beat 1 1/2 cups whipping cream in chilled medium bowl with electric mixer on high speed until stiff. Fold chocolate mixture into whipped cream with a rubber scraper. (I've also done this by adding ~1/4c of the cream into the chocolate & mixing, to loosen the chocolate up, before adding the now smoother chocolate into the whipped cream).
Chill for at least an hour, 2-3 is best. If you eat it without chilling, it's pretty tasty, but if you wait, then it's astoundingly good.`.split('\n')
],
}, parser, { lexicon });Output:
Ingredients:
- 4 egg yolks
- 1/4 c sugar
- 1 c heavy cream
- 6 oz dark chocolate chips [or semisweet chocolate chips] {eq 1 c}
- 1.5 c heavy cream
Instructions:
- Chop the [dark chocolate][4] quite small (I use a small food processor that was probably meant for spices or coffee).
- Beat [egg yolks][1] in small bowl with electric mixer on high speed about 3 minutes or until thick and [lemon][?] colored.
- Gradually beat in [sugar][2].
- Heat 1 cup whipping [cream][3] in 2-quart saucepan over medium heat until hot. Gradually stir at least half of the hot whipping [cream][5] into the bowl with [egg yolk][1] mixture (to temper it); stir back into hot [cream][3] in saucepan.
- Cook over low heat about 5 minutes (or less), stirring constantly, until mixture thickens (do not boil).
- Put finely-chopped [chocolate][4] into a bowl, ideally one that has a lid so it can go in the fridge to chill.
- Gradually add the hot [egg][1] mixture (custard) into the [chocolate][4], I add it by quarter cups, stirring well after each addition. The mixture should not have oil separated (that means you added the [egg][1] too fast) - if it does, the resulting mousse will be less smooth (but still very tasty).
- Cover and refrigerate, 2-4 hours.
- Beat 1 1/2 cups whipping [cream][5] in chilled medium bowl with electric mixer on high speed until stiff. Fold [chocolate][4] mixture into whipped [cream][3] with a rubber scraper. (I've also done this by adding ~1/4c of the [cream][5] into the [chocolate][4] & mixing, to loosen the [chocolate][4] up, before adding the now smoother [chocolate][4] into the whipped [cream][3]).
- Chill for at least an hour, 2-3 is best. If you eat it without chilling, it's pretty tasty, but if you wait, then it's astoundingly good.
