Dialogue policy and state tracker update

This commit is contained in:
Piotr Kopycki 2021-05-30 19:01:45 +02:00
parent 70606851a1
commit 217f43a282
9 changed files with 93 additions and 6 deletions

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../../:\Projects\Git\SystemyDialogowe\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.9 (se_venv)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="pytest" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (se_venv)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/SystemyDialogowe.iml" filepath="$PROJECT_DIR$/.idea/SystemyDialogowe.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,6 +1,7 @@
from SystemAct import SystemAct
from UserActType import UserActType
from SystemActType import SystemActType
from collections import defaultdict
class DP:
@ -11,15 +12,42 @@ class DP:
"""
def __init__(self):
pass
self.results = []
def chooseTactic(self, frameList=None) -> SystemAct:
userAct = frameList[-1]
if userAct.getActType() == UserActType.HELLO:
def chooseTactic(self, current_frame) -> SystemAct:
#userAct = frameList[-1]
if current_frame.getActType() == UserActType.HELLO:
return SystemAct(SystemActType.WELCOME_MSG)
elif userAct.getActType() == UserActType.BYE:
elif current_frame.getActType() == UserActType.BYE:
return SystemAct(SystemActType.BYE)
elif userAct.getActType() == UserActType.INVALID:
elif current_frame.getActType() == UserActType.CONFIRM:
# Czy napewno zawsze po Confirm jest Affirm?
return SystemAct(SystemActType.AFFIRM)
elif current_frame.getActType() == UserActType.NEGATE:
# TODO rozpoznanie czy ma się już komplet danych
# Affirm (gdy ma się wszystkie potrzebne zdanie)
# Request (gdy potrzeba się dopytać dalej)
# Bye (gdy to odp na REQMORE)
return SystemAct(SystemActType.AFFIRM)
elif current_frame.getActType() == UserActType.THANKYOU:
return SystemAct(SystemActType.REQMORE)
elif current_frame.getActType() == UserActType.INFORM:
# TODO najczęściej chyba AFFIRM, CONFIRM_DOMAIN i REQUEST
return SystemAct(SystemActType.REQUEST)
elif current_frame.getActType() == UserActType.CREATE_MEETING:
# TODO najczęściej chyba CONFIRM_DOMAIN i REQUEST
return SystemAct(SystemActType.REQUEST)
elif current_frame.getActType() == UserActType.UPDATE_MEETING:
# TODO rozpoznanie czy ma się już komplet danych jak nie to REQUEST jak tak to CONFIRM_DOMAIN
return SystemAct(SystemActType.REQUEST)
elif current_frame.getActType() == UserActType.CANCEL_MEETING:
# TODO rozpoznanie czy ma się już komplet danych jak nie to REQUEST jak tak to CONFIRM_DOMAIN
return SystemAct(SystemActType.REQUEST)
elif current_frame.getActType() == UserActType.MEETING_LIST:
return SystemAct(SystemActType.INFORM, ["meeting_list"])
elif current_frame.getActType() == UserActType.FREE_TIME:
return SystemAct(SystemActType.INFORM, ["freetime"])
elif current_frame.getActType() == UserActType.INVALID:
return SystemAct(SystemActType.NOT_UNDERSTOOD)
else:
return SystemAct(SystemActType.INFORM,['name'])

View File

@ -11,6 +11,12 @@ class DST:
def __init__(self):
self.frameList = []
self.state = None
def update(self, frame):
self.addFrame(frame)
self.state = frame
return self.state
def addFrame(self, frame):
self.frameList.append(frame)

View File

@ -6,4 +6,10 @@ class SystemActType(Enum):
WELCOME_MSG = 0
INFORM = 1
BYE = 2
REQUEST = 3
INFORM = 4
AFFIRM = 5
CONFIRM_DOMAIN = 6
OFFER = 7
REQMORE = 8
NOT_UNDERSTOOD = -1