diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..549ce75
--- /dev/null
+++ b/.idea/.gitignore
@@ -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/
diff --git a/.idea/SystemyDialogowe.iml b/.idea/SystemyDialogowe.iml
new file mode 100644
index 0000000..11d95b0
--- /dev/null
+++ b/.idea/SystemyDialogowe.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..879c1dd
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..7af44d3
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DialoguePolicy.py b/DialoguePolicy.py
index 2bf7a1b..a837e84 100644
--- a/DialoguePolicy.py
+++ b/DialoguePolicy.py
@@ -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'])
diff --git a/DialogueStateTracker.py b/DialogueStateTracker.py
index e563e1d..f9d6ff1 100644
--- a/DialogueStateTracker.py
+++ b/DialogueStateTracker.py
@@ -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)
diff --git a/SystemActType.py b/SystemActType.py
index 338090d..3747b10 100644
--- a/SystemActType.py
+++ b/SystemActType.py
@@ -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