added more units

This commit is contained in:
Andrei Stoica 2022-07-22 18:57:26 -04:00
parent 39e13a3454
commit 3092f67899
1 changed files with 4 additions and 2 deletions

View File

@ -11,9 +11,11 @@ import logging
from argparse import ArgumentParser
def parse_ingredient(ingredient_text):
units = ['teaspoon', 'tablespoon', 'gram', 'once', 'jar', 'cup', 'pinch',
units = ['teaspoon', 'tablespoon', 'gram', 'ounce', 'jar', 'cup', 'pinch',
'container', 'slice', 'package', 'pound', 'can', 'dash', 'spear',
'bunch', 'quart', 'cube', 'envelope', 'square', 'sprig']
'bunch', 'quart', 'cube', 'envelope', 'square', 'sprig', 'bags',
'box', 'drop', 'fluid ounce', 'gallon', 'head', 'link', 'loaf',
'pint', 'pod', 'sheet', 'stalk', 'whole', 'bar']
number_regex = '((?:[\d\\./\\u00BC-\\u00BE\\u2150-\\u215E]*\s?(?:\(.+\))?)*)'
ingredient_regex = '([a-zA-Z \'\-]+)'
supplement_regex = ',?(.*)'