mockup #7
@ -9,16 +9,22 @@ class DST:
|
|||||||
def getDialogueState(self, userActs):
|
def getDialogueState(self, userActs):
|
||||||
# iterate over speech acts
|
# iterate over speech acts
|
||||||
|
|
||||||
for k, v in userActs['inform'].items():
|
"""for k, v in userActs['inform'].items():
|
||||||
for slot in self.slots:
|
for slot in self.slots:
|
||||||
if slot == k:
|
if slot == k:
|
||||||
self.slots['name'] = v
|
self.slots['name'] = v
|
||||||
print(self.slots)
|
print(self.slots)"""
|
||||||
|
if userActs['act']=='book':
|
||||||
|
for (k,v) in userActs['slots']:
|
||||||
|
print(k)
|
||||||
|
if k in self.slots:
|
||||||
|
self.slots[k]=v
|
||||||
|
|
||||||
# returns all slots
|
# returns all slots
|
||||||
pass
|
return self.slots
|
||||||
|
|
||||||
|
|
||||||
dst = DST()
|
dst = DST()
|
||||||
userActs = {'inform': {'name': 'edyta', 'age': 18}, 'reqmore': {'date', 'time'}}
|
#userActs = {'inform': {'name': 'edyta', 'age': 18}, 'reqmore': {'date', 'time'}}
|
||||||
dst.getDialogueState(userActs)
|
ivona_acts={'act':'book','slots':[('name','ewa'), ('hour','dziesiąta'), ('size','trzech')]}
|
||||||
|
print(dst.getDialogueState(ivona_acts))
|
||||||
|
@ -25,3 +25,7 @@ class NLU:
|
|||||||
return NLU.getDialogAct(matched[0])
|
return NLU.getDialogAct(matched[0])
|
||||||
else:
|
else:
|
||||||
return {'act': 'null', 'slots': []}
|
return {'act': 'null', 'slots': []}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print(nlu.nlu("Cześć, jak masz na imię?"))
|
Loading…
Reference in New Issue
Block a user