Spaces:
Sleeping
Sleeping
293droid commited on
Commit ·
93f936b
1
Parent(s): 885e806
fix: parser handles em-dash in optimise input
Browse files
app.py
CHANGED
|
@@ -87,7 +87,7 @@ OIL_ALIASES = {
|
|
| 87 |
def parse_recipe(text: str) -> dict[str, float]:
|
| 88 |
text_lower = text.lower()
|
| 89 |
recipe = {}
|
| 90 |
-
pattern = r'(\d+(?:\.\d+)?)\s*(?:g|grams?|gram|%)?\s+([a-z\s,()]+?)(?=\d|$|,|and\b|with\b|\n)'
|
| 91 |
matches = re.findall(pattern, text_lower)
|
| 92 |
for weight_str, oil_fragment in matches:
|
| 93 |
weight = float(weight_str)
|
|
|
|
| 87 |
def parse_recipe(text: str) -> dict[str, float]:
|
| 88 |
text_lower = text.lower()
|
| 89 |
recipe = {}
|
| 90 |
+
pattern = r'(\d+(?:\.\d+)?)\s*(?:g|grams?|gram|%)?\s+([a-z\s,()]+?)(?=\d|$|,|and\b|with\b|\n|—|-{1,2})'
|
| 91 |
matches = re.findall(pattern, text_lower)
|
| 92 |
for weight_str, oil_fragment in matches:
|
| 93 |
weight = float(weight_str)
|