3 ms·
I wrote an ingredient parser that is basically just one giant regular expression: https://github.com/falk-hueffner/metric-cooking/blob/master/metric-cooking.js
by hairtuq 5y ago
I wrote an ingredient parser that is basically just one giant regular expression:
https://github.com/falk-hueffner/metric-cooking/blob/master/metric-cooking.js https://github.com/falk-hueffner/metric-cooking/blob/master/...
The use case is a bit different (the task includes finding ingredients mentioned in a longer text, and it'll rather not parse something rather than parsing it wrong), but it works fairly OK and can even parse things like "3/4 cup plus 2 tablespoons packed light-brown sugar".