recipe_parser_andrewromanyk

Crates.iorecipe_parser_andrewromanyk
lib.rsrecipe_parser_andrewromanyk
version0.1.2
sourcesrc
created_at2024-11-10 20:26:41.652658
updated_at2024-11-10 20:36:17.084742
descriptionA parser for food recipes. Divides recipes into: name, description, ingredients and instructions.
homepage
repository
max_upload_size
id1443198
size23,303
Andrii Romaniuk (andrewromanyk)

documentation

README

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 = [
    "Нарізати ковбасу і покласти на хліб",
    "Покласти сир на ковабсу"
]
Commit count: 0

cargo fmt