DialogueState.py correction
This commit is contained in:
parent
a6169d14c1
commit
3c8b0f7e88
@ -1,6 +1,6 @@
|
||||
class DialogueState:
|
||||
|
||||
def init(self):
|
||||
def __init__(self):
|
||||
self.currentActs = []
|
||||
self.previousActs = []
|
||||
self.botName = 'Dia'
|
||||
|
15
model/SystemActFrame.py
Normal file
15
model/SystemActFrame.py
Normal file
@ -0,0 +1,15 @@
|
||||
class SystemActFrame:
|
||||
|
||||
def __init__(self, act, parameters):
|
||||
self.act = act
|
||||
self.parameters = parameters
|
||||
|
||||
def __str__(self):
|
||||
result = ""
|
||||
result += "Act: " + self.act + " Parameters: { "
|
||||
for index, parameter in enumerate(self.parameters):
|
||||
result += parameter
|
||||
if index < len(self.parameters) - 1:
|
||||
result += ', '
|
||||
result += ' }'
|
||||
return result
|
@ -1,9 +1,13 @@
|
||||
from presenter.chatbot_modules.DialogueStateTracker import DialogueStateTracker
|
||||
from presenter.chatbot_modules.NaturalLanguageUnderstanding import NaturalLanguageUnderstanding
|
||||
|
||||
|
||||
class Presenter:
|
||||
dialogue_state_tracker = DialogueStateTracker()
|
||||
nlu = NaturalLanguageUnderstanding()
|
||||
|
||||
def process_user_input(self, user_input):
|
||||
nlu = NaturalLanguageUnderstanding()
|
||||
user_frames = nlu.text_to_user_frame(user_input)
|
||||
user_frames = self.nlu.text_to_user_frame(user_input)
|
||||
dialogue_state = self.dialogue_state_tracker.processUserAct(user_frames)
|
||||
|
||||
return ''
|
||||
|
@ -1,10 +1,9 @@
|
||||
from model import DialogueState
|
||||
|
||||
from model.DialogueState import DialogueState
|
||||
class DialoguePolicy:
|
||||
pass
|
||||
|
||||
def init(self):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def resolveSystemActs(self, dialogueState):
|
||||
|
||||
pass
|
@ -1,40 +1,31 @@
|
||||
from model import DialogueState
|
||||
from model.DialogueState import DialogueState
|
||||
|
||||
|
||||
class DialogueStateTracker:
|
||||
|
||||
def init(self, dialogueState):
|
||||
pass
|
||||
def __init__(self):
|
||||
self.dialogueState = DialogueState()
|
||||
|
||||
def processinformFrame(self, userActsFrame, dialogueState):
|
||||
"""
|
||||
|
||||
:param userActsFrame:
|
||||
:param dialogueState:
|
||||
:return:
|
||||
"""
|
||||
|
||||
|
||||
def processUserAct(self, userActsFrame, dialogueState):
|
||||
def processUserAct(self, userActsFrame):
|
||||
"""
|
||||
|
||||
:param userActsFrame: input of user acts incoming
|
||||
:return: dialogueState
|
||||
"""
|
||||
dialogueState.currentActs=userActsFrame
|
||||
self.dialogueState.currentActs = userActsFrame
|
||||
|
||||
if userActsFrame.act == 'hello()':
|
||||
pass
|
||||
elif userActsFrame.act == 'request':
|
||||
pass
|
||||
elif userActsFrame.act == 'inform':
|
||||
dialogueState=self.processinformFrame(userActsFrame, dialogueState)
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
return dialogueState
|
||||
return self.dialogueState
|
||||
|
||||
def setDialogueState(self, dialogueState):
|
||||
self.dialogueState = dialogueState
|
||||
|
||||
# def setDialogueState(self, dialogueState):
|
||||
# self.DialogueState=dialogueState
|
||||
#
|
||||
# def getDialogueState(self, dialogueState):
|
||||
# return self.DialogueState
|
||||
def getDialogueState(self, dialogueState):
|
||||
return self.dialogueState
|
||||
|
Loading…
Reference in New Issue
Block a user