Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
removed trigger words
Browse files Browse the repository at this point in the history
  • Loading branch information
jdorweiler committed Mar 11, 2015
1 parent 1376d5b commit ff29bd3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
2 changes: 1 addition & 1 deletion lib/DDG/Spice/Nutrition.pm
Expand Up @@ -17,7 +17,7 @@ attribution github => ['https://github.com/andrey-p','Andrey Pissantchev'];
my $attribute_regex = qr/(?^:(?^:(?:c(?:a(?:l(?:ories(?: from fat)?|cium|s)|rb(?:ohydrate)?s)|holesterol)|p(?:olyunsaturated fat|rotein)|trans(?: fat(?:ty acid)?|-fat)|s(?:aturated fat|odium|ugar)|monounsaturated fat|dietary fiber|f(?:iber|at)|vitamin [ac]|kcals|iron)))/;
my $question_regex = qr/(?:how|what)?\s?(?:'s |is |are |many |much )?(?:the |there )?(?:total |amount of |number of )?/;

triggers any => 'kcals', 'cals','calories','dietary fiber','trans-fat','trans fat','trans fatty acid','calories from fat','saturated fat','monosaturated fat','polyunsaturated fat','cholesterol','sodium','sugar','protein','carbs','carbohydrates','vitamin c','vitamin a','calcium';
triggers any => 'calories';

# brand_id is hard coded to USDA for now. Eventually could support searches across brands (i.e. packaged goods or restaurants, but requires multiple
# calls to their API so waiting for now):
Expand Down
47 changes: 1 addition & 46 deletions t/Nutrition.t
Expand Up @@ -17,61 +17,16 @@ ddg_spice_test(
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'protein in tilapia' => test_spice(
'/js/spice/nutrition/tilapia',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'vitamin c in an orange' => test_spice(
'/js/spice/nutrition/orange',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'trans-fat in a ribeye steak' => test_spice(
'/js/spice/nutrition/ribeye%20steak',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'how many carbs in brown rice' => test_spice(
'/js/spice/nutrition/brown%20rice',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'number of calories from fat in a banana' => test_spice(
'/js/spice/nutrition/banana',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'total calcium in glass of milk' => test_spice(
'/js/spice/nutrition/glass%20of%20milk',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'are there carbs in mashed potatoes?' => test_spice(
'/js/spice/nutrition/mashed%20potatoes',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'how much sugar is in blueberries?' => test_spice(
'/js/spice/nutrition/blueberries',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'saturated fat in spam' => test_spice(
'/js/spice/nutrition/spam',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'tofu calories' => test_spice(
'/js/spice/nutrition/tofu',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
'tofu how much protein' => test_spice(
'/js/spice/nutrition/tofu',
call_type => 'include',
caller => 'DDG::Spice::Nutrition',
),
)
);

done_testing;

0 comments on commit ff29bd3

Please sign in to comment.