2022-04-19 22:53:05 +02:00
|
|
|
dialogue_state = []
|
2022-05-25 12:21:06 +02:00
|
|
|
iterator = 1
|
2022-04-19 22:53:05 +02:00
|
|
|
|
2022-06-01 12:22:40 +02:00
|
|
|
def monitor_stanu_dialogowego(frame, questions):
|
2022-05-25 12:21:06 +02:00
|
|
|
global iterator
|
2022-04-19 22:53:05 +02:00
|
|
|
# Some frames can reset the dialogue state, like saying hello.
|
|
|
|
reset_state_if_needed(frame)
|
2022-05-25 12:21:06 +02:00
|
|
|
singleState = {
|
|
|
|
"iteration": iterator,
|
2022-06-01 12:22:40 +02:00
|
|
|
"frame": frame,
|
|
|
|
"questions": questions
|
2022-05-25 12:21:06 +02:00
|
|
|
}
|
|
|
|
dialogue_state.append(singleState)
|
|
|
|
iterator += 1
|
2022-04-19 22:53:05 +02:00
|
|
|
return dialogue_state
|
|
|
|
|
|
|
|
|
|
|
|
def reset_state_if_needed(frame):
|
2022-05-25 12:21:06 +02:00
|
|
|
global iterator
|
2022-05-25 12:52:02 +02:00
|
|
|
if frame['act'] == "hello" or frame['act'] == "bye":
|
2022-04-19 22:53:05 +02:00
|
|
|
dialogue_state.clear()
|
2022-05-25 12:21:06 +02:00
|
|
|
iterator = 1
|
2022-04-19 22:53:05 +02:00
|
|
|
|