Commit Graph

23 Commits

Author SHA1 Message Date
Andrew Jayne
cffa731106 fix: ingredient parsing for non-latin languages
Before this change the ingredient string for non-latin
languages was not being parsed into the correct amount
or units when the food is found at the start of the
ingredient string.

This was because the regex being used was restricted to
latin characters.

With this change the amount and units are correctly
parsed from such a string.

Fixes https://github.com/TandoorRecipes/recipes/issues/1983
2022-08-07 21:37:59 +01:00
vabene1111
f872f994f1 fixed import failure with leading commas in input strings 2022-05-18 15:29:03 +02:00
vabene1111
825b7b7cf9 ingredient editor and parser 2022-04-23 19:58:40 +02:00
vabene1111
e2ab3a0efb fixed ingredient parser length issues 2022-04-23 14:15:06 +02:00
vabene1111
e0b7d1a8f0 added support for unit/amount at end of ingredient 2022-04-23 13:53:04 +02:00
vabene1111
012a1a7915 ingredient parser produces expected results again 2022-04-23 13:03:15 +02:00
vabene1111
9b132e71f2 screw up ingredient parser 2022-04-23 01:21:13 +02:00
vabene1111
85aad42529 added mela recipes importer 2022-04-04 21:09:47 +02:00
vabene1111
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
vabene1111
f3593e8151 implemented rule processing in ingredient parser 2021-09-16 18:31:21 +02:00
vabene1111
a7dc23194e converted ingredient parser to class and added automation beta hint 2021-09-16 17:52:11 +02:00
vabene1111
fd1a399d03 more improvements to the ingredient parser + tests 2021-06-21 13:00:03 +02:00
vabene1111
256c1a7d41 improved ingredient parser 2021-06-18 17:36:31 +02:00
vabene1111
9856857c51 updated openeats importer 2021-06-11 15:28:11 +02:00
vabene1111
f04a51c1ad fixed empty units/foods (again) 2021-03-19 00:19:29 +01:00
Aaron
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
Tobias Lindenberg
b59c7288b1 helper/ingredient_parser 2021-01-10 13:44:55 +01:00
vabene1111
e9f2b875b9 formatting 2021-01-07 22:47:53 +01:00
Jakob Wenzel
29903af085 catch error when trying to parse into ingredient/note 2021-01-07 19:49:02 +01:00
Jakob Wenzel
8ed2562454 allow plural-suffixes in ingredient parser 2021-01-07 19:30:07 +01:00
Aaron
79396cec9e
switch from double to single quotes 2020-12-21 22:42:27 +01:00
Aaron
5e07c6130f
Switch to 4-space indentation 2020-12-21 20:14:32 +01:00
Aaron
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