Compare commits

..

3 Commits

Author SHA1 Message Date
wojbal2
74e9eb31a8 Mockup nlu 2023-03-31 22:30:50 +02:00
wojciechbatruszewicz
c6a4cb754e Mockups nlu 2023-03-31 19:23:16 +02:00
wojciechbatruszewicz
60d6f674ee Mockups 2023-03-31 19:19:29 +02:00

107
SDMockup.ipynb Normal file
View File

@ -0,0 +1,107 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# ASR"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def asr(inputText: str) -> str:\n",
" # Do something\n",
" inputText\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# NLU"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"class Nlu:\n",
" def __init__(self, text: str):\n",
" self.text = text\n",
" self.slot = []\n",
" \n",
" def get_dialog_act(self):\n",
" act = \"question\" if \"?\" in self.text else \"\"\n",
" if \"imię\" in self.text:\n",
" self.slot.append((\"o_co\", \"imie\"))\n",
" return {\"act\": act, \"slot\": self.slot }\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'act': 'question', 'slot': [('o_co', 'imie')]}"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nlu = Nlu(\"Jak masz na imię?\")\n",
"nlu.get_dialog_act()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "SDenv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}