Name: ingreedy
Owner: Cookpad Inc.
Description: natural language parsing of recipe ingredients, making sense of amounts, units, and ingredients
Created: 2015-11-30 12:45:02.0
Updated: 2018-02-01 17:04:41.0
Pushed: 2017-11-01 10:32:29.0
Size: 113
Language: Ruby
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
lt = Ingreedy.parse('1 lb. potatoes')
t result.amount
> 1.0
t result.unit
> :pound
t result.ingredient
> "potatoes"
eedy.dictionaries[:fr] = {
its: { dash: ['pincée'] },
mbers: { 'une' => 1 },
epositions: ['de']
nge_separators: ['ou']
eedy.locale = :fr # Also automatically follows I18n.locale if available
lt = Ingreedy.parse('une pincée de sucre')
t result.amount
> 1.0
t result.unit
> :dash
t result.ingredient
> "sucre"
By default, Ingreedy will convert all amounts to a rational number:
lt = Ingreedy.parse("1 1/2 cups flour")
t result.amount
> 3/2
However, setting Ingreedy.preverse_amounts = true
, will allow amounts
to be detected and returned as originally input:
eedy.preserve_amounts = true
lt = Ingreedy.parse("1 1/2 cups flour")
t result.amount
> 1 1/2
Run the tests:
c spec