Commit Graph

39 Commits

Author SHA1 Message Date
vabene1111
76b84898f6 lmit ingredient parser to 512 characters to prevent too complex computations 2023-12-16 09:08:50 +01:00
smilerz
768a5ea237
Squashed commit of the following:
commit 36403ecbae
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 12:04:04 2023 -0500

    update migration for new Automation Types

commit 4620ebaf30
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 07:49:10 2023 -0500

    add Name and Instruction automation to YouTube importer

commit c907da84c1
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 07:45:32 2023 -0500

    remove old commented automation code

commit 9b5e39415e
Author: smilerz <smilerz@gmail.com>
Date:   Fri Sep 1 07:37:36 2023 -0500

    test for automations applied during url import
    renamed TITLE_REPLACE to NAME_REPLACE

commit 2679a22464
Author: smilerz <smilerz@gmail.com>
Date:   Thu Aug 31 15:29:59 2023 -0500

    added tests for regex_replace

commit 8bae21025b
Author: smilerz <smilerz@gmail.com>
Date:   Thu Aug 31 13:51:46 2023 -0500

    updated Automation Modal and translations

commit 4120adc546
Author: smilerz <smilerz@gmail.com>
Date:   Thu Aug 31 13:12:41 2023 -0500

    applied regex_replace automation to food and unit automations
    updated automation documentation

commit 30c891abfc
Author: smilerz <smilerz@gmail.com>
Date:   Thu Aug 31 12:46:34 2023 -0500

    migrate regex_replace functions to AutomationEngine
    create TITLE_REPLACE, UNIT_REPLACE and FOOD REPLACE automation types
    create migration for new types

commit b8317c2c29
Author: smilerz <smilerz@gmail.com>
Date:   Wed Aug 30 20:44:40 2023 -0500

    move transpose words to AutomationEngine
    create tests for transpose words

commit 39253cfd02
Author: smilerz <smilerz@gmail.com>
Date:   Wed Aug 30 17:03:29 2023 -0500

    refactor never_unit automation to AutomationEngine
    create tests for never_unit

commit 7c0b8b151c
Author: smilerz <smilerz@gmail.com>
Date:   Wed Aug 30 11:21:06 2023 -0500

    update ingredient parser to use AutomationEngine for unt, keyword, food
    update test_ingredient_parser tests to accomodate changes

commit 8e1b8923af
Author: smilerz <smilerz@gmail.com>
Date:   Mon Aug 28 16:44:35 2023 -0500

    keyword and unit Automtations refactored to Automation Engine
    keyword and unit automation tests added

commit 52eb876a08
Author: smilerz <smilerz@gmail.com>
Date:   Mon Aug 28 15:03:19 2023 -0500

    food_alias tests added

commit a820b9c09e
Author: smilerz <smilerz@gmail.com>
Date:   Sat Aug 26 12:37:16 2023 -0500

    create AutomationEngine class
    create food_automation method
    refactor food automations to use AutomationEngine
2023-09-12 09:46:08 -05:00
smilerz
fde4ea8c4c
filtered automations to tokens present 2023-08-25 08:01:56 -05:00
smilerz
132815496c
create Transpose Words automation 2023-08-25 08:01:26 -05:00
smilerz
2f617aa40f
fix incorrect variable in apply_transpose_words_automations 2023-08-25 07:54:07 -05:00
smilerz
9b50ea4c22
make automation parameters case insensitive on search 2023-08-25 07:54:06 -05:00
smilerz
cde8dd8b53
fixed defect in NEVER_UNIT automation 2023-08-25 07:54:06 -05:00
smilerz
8411537f87
filtered automations to tokens present 2023-08-25 07:54:05 -05:00
smilerz
479cf1a042
create Transpose Words automation 2023-08-25 07:54:05 -05:00
smilerz
8fa00972bd
add NEVER_UNIT automation 2023-08-25 07:53:53 -05:00
vabene1111
9846c4df18 added support for rezeptsuite.de imports 2023-02-11 17:51:44 +01:00
Marcus Wolschon
b4c26682c7 simplify 2023-01-17 15:20:59 +01:00
Marcus Wolschon
c690bc18a0 Fix CodeQL issue with regular expression 2023-01-15 14:27:55 +01:00
Marcus Wolschon
394f24c29f handle special cases in ingredients 2023-01-15 13:50:06 +01:00
vabene1111
6176eeb024 basics 2023-01-03 23:12:00 +01:00
vabene1111
24f331c208 improved ingredient parser handling of amount unit without space 2022-11-09 14:24:12 +01:00
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