Last active
September 21, 2016 20:37
-
-
Save melissamcewen/ba3107c22df73f7da817efa4690ff0bb to your computer and use it in GitHub Desktop.
Wit.ai figuring out slotting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findRestaurant({context,entities}) { | |
return new Promise(function(resolve, reject) { | |
var cuisine = firstEntityValue(entities, 'cuisine'); | |
var neighborhood = firstEntityValue(entities, 'neighborhood'); | |
console.log('cuisine:' + cuisine); | |
console.log('neighborhood:' + neighborhood); | |
if (cuisine && neighborhood) { | |
console.log('both cuisine and neighborhood present'); | |
} else if (neighborhood) { | |
context.neighborhood = neighborhood; | |
} else { | |
context.cuisine = cuisine; | |
} | |
console.log(JSON.stringify(context)); | |
//call the API here | |
return resolve(context); | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment