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

fix(server): make use of current entities to match global entities

This commit is contained in:
louistiti 2022-06-26 12:40:29 +08:00
parent 2e66be25ef
commit a8d82050c8
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6
5 changed files with 84 additions and 82 deletions

View File

@ -0,0 +1,40 @@
{
"options": {
"Alexa": {
"synonyms": ["Alexa"],
"data": {
"thought": [
"Alexa is very kind and Amazon is teaching it many things. It was born in November 2014.",
"Alexa has been created by Amazon and was born in November 2014. We went for a drink few weeks ago and I have to admit it is funny."
]
}
},
"Cortana": {
"synonyms": ["Cortana"],
"data": {
"thought": [
"Cortana is thoughtful and Microsoft is improving her day after day. She was born in April 2014.",
"Cortana has been created by Microsoft and was born in April 2014. We went for a walk few weeks ago, it was a very nice hike."
]
}
},
"Siri": {
"synonyms": ["Siri"],
"data": {
"thought": [
"I consider Siri as a leader, it has a lot of experience and Apple is constantly improving it. It was born in October 2011.",
"Siri has been acquired by Apple and was born in October 2011. True story, we went for a brunch together and it brought apples..."
]
}
},
"Google Assistant": {
"synonyms": ["Google Assistant"],
"data": {
"thought": [
"Google Assistant is smart and Google is doing a great job with it. It was born in May 2016.",
"Google Assistant has been created by Google and was born in May 2016. We met for the first time at the Google I/O. It was a great event!"
]
}
}
}
}

View File

@ -0,0 +1,40 @@
{
"options": {
"Alexa": {
"synonyms": ["Alexa"],
"data": {
"thought": [
"Alexa est très sympa et Amazon lui enseigne pleins de choses. Elle est née en novembre 2014.",
"Alexa a été créée par Amazon et est née en novembre 2014. Nous sommes allé boire un verre il y a quelques semaines de ça, et je dois admettre qu'elle est très drôle."
]
}
},
"Cortana": {
"synonyms": ["Cortana"],
"data": {
"thought": [
"Cortana est réfléchie et Microsoft l'améliore jour après jour. Elle est née en avril 2014.",
"Cortana a été créée par Microsoft et est née en avril 2014. Nous sommes allez faire une balade il y a quelques semaines et ce fut très plaisant."
]
}
},
"Siri": {
"synonyms": ["Siri"],
"data": {
"thought": [
"Je considère Siri comme un père, il a beaucoup d'expérience et Apple l'améliore de jour en jour. Il est né en octobre 2011.",
"Siri a été racheté par Apple et est né en octobre 2011. Histoire vraie, nous sommes allez faire un brunch et il a apporté des pommes..."
]
}
},
"Google Assistant": {
"synonyms": ["google assistant"],
"data": {
"thought": [
"L'assistante Google est intelligente et Google fait du beau travail avec elle. Elle est née en mai 2016.",
"L'assistante Google a été crée par Google et est née en mai 2016. Nous nous sommes rencontrés pour la première fois à la Google I/O. C'était un superbe événement."
]
}
}
}
}

View File

@ -390,10 +390,10 @@ class Brain {
* then map them (utterance <-> answer)
*/
if (utteranceHasEntities && answer.indexOf('{{') !== -1) {
obj.entities.forEach((entityObj) => {
obj.currentEntities.forEach((entityObj) => {
answer = string.pnr(answer, { [`{{ ${entityObj.entity} }}`]: entityObj.resolution.value })
// Find matches and map deeper data from the NLU file (global/custom entities)
// Find matches and map deeper data from the NLU file (global entities)
const matches = answer.match(/{{.+?}}/g)
matches?.forEach((match) => {

View File

@ -19,45 +19,6 @@
}
},
"entities": {
"partner_assistant": {
"options": {
"Alexa": {
"synonyms": ["Alexa"],
"data": {
"thought": [
"Alexa is very kind and Amazon is teaching it many things. It was born in November 2014.",
"Alexa has been created by Amazon and was born in November 2014. We went for a drink few weeks ago and I have to admit it is funny."
]
}
},
"Cortana": {
"synonyms": ["Cortana"],
"data": {
"thought": [
"Cortana is thoughtful and Microsoft is improving her day after day. She was born in April 2014.",
"Cortana has been created by Microsoft and was born in April 2014. We went for a walk few weeks ago, it was a very nice hike."
]
}
},
"Siri": {
"synonyms": ["Siri"],
"data": {
"thought": [
"I consider Siri as a leader, it has a lot of experience and Apple is constantly improving it. It was born in October 2011.",
"Siri has been acquired by Apple and was born in October 2011. True story, we went for a brunch together and it brought apples..."
]
}
},
"Google Assistant": {
"synonyms": ["Google Assistant"],
"data": {
"thought": [
"Google Assistant is smart and Google is doing a great job with it. It was born in May 2016.",
"Google Assistant has been created by Google and was born in May 2016. We met for the first time at the Google I/O. It was a great event!"
]
}
}
}
}
"partner_assistant": "global-entities/partner_assistant.json"
}
}

View File

@ -19,45 +19,6 @@
}
},
"entities": {
"partner_assistant": {
"options": {
"Alexa": {
"synonyms": ["alexa"],
"data": {
"thought": [
"Alexa is very kind and Amazon is teaching it many things. It was born in November 2014.",
"Alexa has been created by Amazon and was born in November 2014. We went for a drink few weeks ago and I have to admit it is funny."
]
}
},
"Cortana": {
"synonyms": ["cortana"],
"data": {
"thought": [
"Cortana est réfléchie et Microsoft l'améliore jour après jour. Elle est née en avril 2014.",
"Cortana a été créée par Microsoft et est née en avril 2014. Nous sommes allez faire une balade il y a quelques semaines et ce fut très plaisant."
]
}
},
"Siri": {
"synonyms": ["siri"],
"data": {
"thought": [
"Je considère Siri comme un père, il a beaucoup d'expérience et Apple l'améliore de jour en jour. Il est né en octobre 2011.",
"Siri a été racheté par Apple et est né en octobre 2011. Histoire vraie, nous sommes allez faire un brunch et il a apporté des pommes..."
]
}
},
"Google Assistant": {
"synonyms": ["google assistant"],
"data": {
"thought": [
"L'assistante Google est intelligente et Google fait du beau travail avec elle. Elle est née en mai 2016.",
"L'assistante Google a été crée par Google et est née en mai 2016. Nous nous sommes rencontrés pour la première fois à la Google I/O. C'était un superbe événement."
]
}
}
}
}
"partner_assistant": "global-entities/partner_assistant.json"
}
}