add template nlg, add simple rule templates
This commit is contained in:
parent
f73a796df1
commit
330f3bc947
48
template_nlg.ipynb
Normal file
48
template_nlg.ipynb
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import random\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def nlg(system_act):\n",
|
||||
" domain, intent, slot, value = system_act\n",
|
||||
"\n",
|
||||
" if intent == 'Affirm':\n",
|
||||
" r = random.randint(1, 3)\n",
|
||||
"\n",
|
||||
" if r == 1:\n",
|
||||
" return 'Tak'\n",
|
||||
" elif r == 2:\n",
|
||||
" return 'Zgadza się'\n",
|
||||
" else:\n",
|
||||
" return 'Potwierdzam'\n",
|
||||
" \n",
|
||||
" if intent == 'Canthelp':\n",
|
||||
" r = random.randint(1, 3)\n",
|
||||
"\n",
|
||||
" if r == 1:\n",
|
||||
" return 'Przepraszam, ale obawiam się, że nie mogę tego zrobić'\n",
|
||||
" elif r == 2:\n",
|
||||
" return 'Wystąpił błąd, proszę się skontaktować z obsługą'\n",
|
||||
" else:\n",
|
||||
" return 'ERR://23¤Y%/'\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" if domain == 'Product':\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"language_info": {
|
||||
"name": "python"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
Loading…
Reference in New Issue
Block a user