#recipe #ingredient #name #description #food #instructions #parser

bin+lib recipe_parser_andrewromanyk

A parser for food recipes. Divides recipes into: name, description, ingredients and instructions.

3 releases

0.1.2 Nov 10, 2024
0.1.1 Nov 10, 2024
0.1.0 Nov 10, 2024

#1609 in Parser implementations

Download history 294/week @ 2024-11-09 33/week @ 2024-11-16 4/week @ 2024-11-23 4/week @ 2024-11-30 18/week @ 2024-12-07

64 downloads per month

MIT license

11KB
230 lines

recipe_parser_andrewromanyk

A parser for food recipes. Divides recipes into: name, description, ingredients and instructions.

Parts of the recipe:

  • Dish name
    Starts with the keyword followed by the name
  • Dish description
    Starts with the keyword followed by the description
  • Needed ingredients
    A list of ingredients in the "ingredient - amount unit" form
  • Steps how to make the dish
    A list of steps in the
    - step1
    - step2
    - step3
    form

Process

A recipe is parsed by being divided into 4 aforementioned parts, each having its own form. Many rules are "hidden" for easier parsing, e.g. spaces, separate letters, delimiters, etc.

Recipe example

Страва: Бутерброд з ковбасою

Опис: простий бутерброд

Інгредієнти:
Ковбаса - 1 шт
Сир - 1 уп
Хліб - 1 скибка

Кроки:
- Нарізати ковбасу і покласти на хліб
- Покласти сир на ковабсу

Corresponds to

reicpeTitle = "Бутерброд з ковбасою"
recipeDescription = "простий бутерброд"
recipeIngredientsFull = [
    ("Ковбаса", (1, "шт")),
    ("Сир", (1, "уп")),
    ("Хліб", (1, "скибка"))
]
recipeInstructionsFull = [
    "Нарізати ковбасу і покласти на хліб",
    "Покласти сир на ковабсу"
]

Dependencies

~2.2–3MB
~59K SLoC