Extract parenthesised notes from food name to extra field
E.g. "fehérborecet (ízlés szerint)" → food="fehérborecet", extra="ízlés szerint" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -221,6 +221,14 @@ def _parse_streetkitchen(soup: BeautifulSoup, url: str) -> dict:
|
||||
# Split "200g" → qty="200", unit="g"
|
||||
qty, unit = _split_qty_unit(qty_raw)
|
||||
|
||||
# Extract parenthesised note from inside food name
|
||||
# e.g. "fehérborecet (ízlés szerint)" → food="fehérborecet", extra="ízlés szerint"
|
||||
if not extra:
|
||||
m = re.match(r"^(.+?)\s*\(([^)]+)\)\s*$", food)
|
||||
if m:
|
||||
food = m.group(1).strip()
|
||||
extra = m.group(2).strip()
|
||||
|
||||
ingredients.append({
|
||||
"quantity": qty,
|
||||
"unit": unit,
|
||||
|
||||
Reference in New Issue
Block a user