1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-11-27 16:16:48 +03:00

feat: slot filling (wip)

This commit is contained in:
louistiti 2022-03-03 23:50:45 +08:00
parent 9ce9a8bc4f
commit 76547d9411
No known key found for this signature in database
GPG Key ID: 0A1C3B043E70C77D
7 changed files with 112 additions and 1 deletions

View File

@ -1,5 +1,35 @@
{
"endpoints": [
{
"method": "GET",
"route": "/api/action/leon/birthday/leon_birthday",
"params": []
},
{
"method": "GET",
"route": "/api/action/leon/birthday/when_birthday",
"params": []
},
{
"method": "GET",
"route": "/api/action/leon/birthday/my_birthday",
"params": []
},
{
"method": "GET",
"route": "/api/action/leon/birthday/color_meaning",
"params": []
},
{
"method": "GET",
"route": "/api/action/leon/birthday/specific_color_meaning",
"params": []
},
{
"method": "GET",
"route": "/api/action/leon/birthday/why",
"params": []
},
{
"method": "GET",
"route": "/api/action/leon/color/favorite_color",

View File

@ -80,7 +80,10 @@ class Ner {
const conditionMethod = `add${string.snakeToPascalCase(condition.type)}Condition`
if (condition.type === 'between') {
// e.g. list.addBetweenCondition('en', 'list', 'create a', 'list')
/**
* Conditions: https://github.com/axa-group/nlp.js/blob/master/docs/v3/ner-manager.md#trim-named-entities
* e.g. list.addBetweenCondition('en', 'list', 'create a', 'list')
*/
this.ner[conditionMethod](lang, entity.name, condition.from, condition.to)
} else if (condition.type.indexOf('after') !== -1) {
const rule = {

View File

View File

View File

@ -0,0 +1,66 @@
{
"actions": {
"leon_birthday": {
"type": "dialog",
"utterance_samples": [
"What's your birth date?",
"How old are you?",
"When are you born?",
"May I know when is your birthday?"
],
"answers": [
"I'm born in February 2019.",
"My first version has been released in February 2019."
]
},
"when_birthday": {
"type": "logic",
"utterance_samples": [
"Do you know when is my birthday?",
"Do you remember when I am born?",
"Do you know my birth date?",
"When is Phoebe's birthday?",
"Give me my birth date"
],
"entities": [
{
"type": "trim",
"name": "person",
"conditions": [
{
"type": "before_last",
"to": ["birthday", "birth date"]
},
{
"type": "between",
"from": ["when"],
"to": ["am","was"]
}
]
}
],
"slots": [
{
"name": "birth_date",
"type": "date"
}
],
"answers": {
"birthday_found": [
"%person%'s birthday is the %birth_date%",
"%person% is born the %birth_date%"
],
"birthday_not_found": [
"I'm not sure to remember, would you please tell me what is %person%'s birth date?",
"I do not know, please share %person% birth date."
]
}
},
"my_birthday": {
"utterance_samples": [
"My birthday is the 6th of August",
"I am born the @day of @month "
]
}
}
}

View File

@ -0,0 +1,12 @@
{
"name": "Birthday",
"type": "dialog",
"bridge": null,
"version": "1.0.0",
"description": "Leon remembers birthdays and talk about his.",
"author": {
"name": "Louis Grenard",
"email": "louis.grenard@gmail.com",
"url": "https://github.com/louistiti"
}
}

View File