Commit Graph

15 Commits

Author SHA1 Message Date
c06c511dc9 changed unit default in ingredient parser to none
because empty name units are not accepted by unit serializer but null values can be handled by the ingredient serializer (as a unit can be null)
2022-02-21 15:35:36 +01:00
f3593e8151 implemented rule processing in ingredient parser 2021-09-16 18:31:21 +02:00
a7dc23194e converted ingredient parser to class and added automation beta hint 2021-09-16 17:52:11 +02:00
fd1a399d03 more improvements to the ingredient parser + tests 2021-06-21 13:00:03 +02:00
256c1a7d41 improved ingredient parser 2021-06-18 17:36:31 +02:00
9856857c51 updated openeats importer 2021-06-11 15:28:11 +02:00
f04a51c1ad fixed empty units/foods (again) 2021-03-19 00:19:29 +01:00
87d6ca0200 Fix ingredient parsing for fractions using '/'
Even though ingredients like '1 1/2 something' already worked fine and got converted to 1.5 something
I just came across a recipe using '1/2' as the whole amount without any whole number before that.
Apparently I overlooked that case before so I now also fixed that.
2021-02-14 18:43:38 +01:00
b59c7288b1 helper/ingredient_parser 2021-01-10 13:44:55 +01:00
e9f2b875b9 formatting 2021-01-07 22:47:53 +01:00
29903af085 catch error when trying to parse into ingredient/note 2021-01-07 19:49:02 +01:00
8ed2562454 allow plural-suffixes in ingredient parser 2021-01-07 19:30:07 +01:00
79396cec9e switch from double to single quotes 2020-12-21 22:42:27 +01:00
5e07c6130f Switch to 4-space indentation 2020-12-21 20:14:32 +01:00
94e1fdfbff Improve text to ingredient parsing
The previous implementation of parsing ingredients was very simple. I now wrote a parser
that I would consider good. It takes care of several edge cases and notations.

- Supports fraction unicode (½, ¼, ⅜, ...)
- Supports notations like `1½` and `1 1/2`
- Supports unit directly after the amount without space inbetween (`2g`, `2½g`)
- Supports notes (`5g onion (cubed)` -> amount: 5, unit: g, ingredient: onion, note: cubed)
- Supports notes (`5g onion, cubed` -> amount: 5, unit: g, ingredient: onion, note: cubed)
- Does not break when both commas and brackets exist
2020-12-21 20:00:46 +01:00