trailminator #1

Merged
s434624 merged 6 commits from trailminator into master 2022-05-18 12:39:33 +02:00
4 changed files with 38 additions and 4 deletions
Showing only changes of commit 1cc1810886 - Show all commits

View File

@ -1,2 +1,14 @@
class Dp:
pass
def __init__(self, act, param):
self.act = act
self.param = param
self.answers = {
'request': {'imie': "welcomemsg"}
}
def identify(self):
req = self.answers.get(self.act)
response = req.get(self.param[0]) if not req is None else "null"
return response if not response is None else "null"

View File

@ -1,2 +1,14 @@
import random
from urllib import response
from scipy import rand
class Nlg:
pass
def __init__(self, response_type: str) -> None:
self._response_type = response_type
self.responses = {"welcomemsg": ["I AM TRAIlMinATor!", "Cześć, jestem TrailMinator"],
"null": "Can't hear you"}
def response(self) -> str:
avail_resps = self.responses.get(self._response_type)
return avail_resps[random.randint(0, len(avail_resps)-1)]

View File

@ -42,5 +42,3 @@ class Nlu:
return (act, param)
nlu = Nlu()
print(nlu.parse('jak masz na imie?'))

View File

@ -0,0 +1,12 @@
import dst
import nlu
import dp
import nlg
if __name__ == "__main__":
msg = "Jak masz na imie?"
dp_params = nlu.Nlu().parse(msg)
# print(dp_params)
nlg_params = dp.Dp(*dp_params).identify()
# print(nlg_params)
print(f"{msg}\n{nlg.Nlg(nlg_params).response()}")