1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-11-23 20:12:08 +03:00

feat(server): introduce resolvers for slot filling (wip)

This commit is contained in:
louistiti 2022-03-22 00:39:36 +08:00
parent 7e70f41774
commit 334bf393f2
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6
5 changed files with 47 additions and 57 deletions

View File

@ -1,18 +0,0 @@
{
"name": "system.affirm",
"utterance_samples": [
"Yes",
"Yep",
"Yup",
"Yeah",
"Let's do it",
"For sure",
"Sure thing",
"Of course!",
"Okay",
"OK",
"Alright",
"Correct",
"Indeed"
]
}

View File

@ -1,12 +0,0 @@
{
"name": "system.deny",
"utterance_samples": [
"No",
"No no don't",
"Nope",
"Naa",
"No thanks",
"No I'm fine",
"Hell no"
]
}

View File

@ -0,0 +1,35 @@
{
"name": "affirm_deny",
"intents": {
"system.affirm": {
"utterance_samples": [
"Yes",
"Yep",
"Yup",
"Yeah",
"Let's do it",
"For sure",
"Sure thing",
"Of course!",
"Okay",
"OK",
"Alright",
"Correct",
"Indeed"
],
"value": true
},
"system.deny": {
"utterance_samples": [
"No",
"No no don't",
"Nope",
"Naa",
"No thanks",
"No I'm fine",
"Hell no"
],
"value": false
}
}
}

View File

@ -80,14 +80,16 @@ export default () => new Promise(async (resolve, reject) => {
/**
* TODO:
* 1. Merge person, location and organization to the
* NER before processing NLU (cf. line 210 in nlu.js)
* NER before processing NLU (cf. line 210 in nlu.js): OK
* 2. Grab intents with slots
* 3. .addSlot() as per the slots config
* 4. Train resolvers (affirm_deny)
*/
if (intent === 'guess_the_number.start') {
console.log('iiin')
// nlp.slotManager.addSlot(intent, 'number', true, { [lang]: 'How many players?' })
nlp.slotManager.addSlot(intent, 'person', true, { [lang]: 'How many players?' })
// nlp.slotManager.addSlot(intent, 'person', true, { [lang]: 'How many players?' })
nlp.slotManager.addSlot(intent, 'boolean', true, { [lang]: 'How many players?' })
}
for (let l = 0; l < utteranceSamples.length; l += 1) {

View File

@ -11,7 +11,9 @@
"slots": [
{
"name": "players_nb",
"entity": "number",
"entity": {
"name": "number"
},
"answers": [
"How many players should I set?"
]
@ -61,34 +63,15 @@
"input_context": [
"deciding"
],
"utterance_samples": [
"Yes",
"Yep",
"Yup",
"Yeah",
"Let's do it",
"For sure",
"Sure thing",
"Of course!",
"No",
"No no don't",
"Nope",
"Naa",
"No thanks",
"No I'm fine",
"Okay",
"OK",
"Alright",
"Correct",
"Indeed"
],
"slots": [
{
"name": "decision",
"entity": {
"boolean": "confirmations.json"
"resolver": {
"name": "affirm_deny"
},
"lifespan": 1
"answers": [
"Would you like to play another round?"
]
}
]
}