dfithian / chez-grater

MIT License
37 stars 1 forks source link

Add --scale option #6

Closed mossprescott closed 2 years ago

mossprescott commented 2 years ago

For example:

$ stack run chez-grater -- --scale "1 1/2"  https://cooking.nytimes.com/recipes/1020384-tomato-cobbler-with-ricotta-biscuits
Tomato Cobbler With Ricotta Biscuits Recipe - NYT Cooking
---------------------------------------------------------
1 cup whole-milk ricotta
3 3/4 cup /320 grams plus 2 tablespoons cake flour, plus more for dusting
1 1/2 tbsp plus 1/4 cup/50 grams granulated sugar
(1 1/2x) Kosher salt and freshly ground black pepper
2 1/4 tsp baking powder
1 1/2 tsp baking soda
3/4 cup /115 grams unsalted butter (1 stick), cut into cubes and chilled
1 1/2 cup /240 milliliters buttermilk, plus 2 tablespoons for brushing
3 to 2 ½ pounds cherry tomatoes or Sungold tomatoes
cup /60 milliliters extra-virgin olive oil
1 1/2 tbsp sherry vinegar
3 sprigs fresh thyme
---------------------------------------------------------
...

I think this is rather useful, actually 😄

Can you spot the bug above?

dfithian commented 2 years ago

You mean (not) parsing multiple quantities as metric/imperial conversions? :laughing:

mossprescott commented 2 years ago

Better now:

...
1 1/8 cup whole-milk ricotta
...
3/8 cup /60 milliliters extra-virgin olive oil
...
mossprescott commented 2 years ago

I'm not very happy with "3 to 2 ½ pounds", but it's sort of out of the scope of what I'm trying to accomplish here, and it's clear in the JSON what's going on, so I think this is a solid addition and I'm done playing with it for the time being.

I think it would be cool to parse things like "1 cup/240 ml" and "2 to 2 ½ pounds" into some kind of ADT, but it's certainly going to complicate both the parser and (worse) the parsed representation. See #7 (and apologies if you weren't looking for feature requests today.)

dfithian commented 2 years ago

Yeah, I like it. It's hard to understand the / contextually as well.

One thing I considered in the past is training a model to recognize recipes based on images, so things like that would be good for the training set :smiling_imp: