recipe_parser_andrewromanyk is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the command-line executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install recipe_parser_andrewromanyk
It will make the recipe_parser_andrewromanyk
command available in your PATH
if you've allowed the PATH
to be modified when installing Rust . cargo uninstall recipe_parser_andrewromanyk
uninstalls.
Adding recipe_parser_andrewromanyk
library as a dependency
Run this command in a terminal, in your project's directory:
cargo add recipe_parser_andrewromanyk
To add it manually, edit your project's Cargo.toml
file and add to the [dependencies]
section:
recipe_parser_andrewromanyk = "0.1.2"
The recipe_parser_andrewromanyk
library will be automatically available globally.
Read the recipe_parser_andrewromanyk
library documentation .
Back to the crate overview .
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 = [
" Нарізати ковбасу і покласти на хліб" ,
" Покласти сир на ковабсу"
]