added question response approve

This commit is contained in:
Jakub Adamski 2022-06-01 12:22:40 +02:00
parent 3ec25c94ff
commit 4d01fc8399
4 changed files with 16 additions and 10 deletions

View File

@ -3,17 +3,24 @@ from taktyka_dialogu import Questions
welcome = 'Witaj!' welcome = 'Witaj!'
unknown = "Nie rozumiem." unknown = "Nie rozumiem."
end = "Żegnaj!" end = "Żegnaj!"
help = "Obsługuję przekazywanie informacji z systemu GitHub - repozytoria, pull requesty, issue, powiadomienia."
def generator_jezyka_nautalnego(frame, question): def generator_jezyka_nautalnego(frame, question, state):
if question != Questions.NONE: if question != Questions.NONE:
#ask additional questions #ask additional questions
if question == Questions.TIME: if question == Questions.TIME:
print("Z jakiego czasu?") print("Z jakiego czasu?")
elif state[-2]['questions'] != Questions.NONE and frame['act'] != "":
print("Przyjęto odpowiedź na pytanie.")
else: else:
#dont ask questions #dont ask questions
if frame['act'] == "hello": if frame['act'] == "hello":
print(welcome) print(welcome)
elif frame['act'] == "bye": elif frame['act'] == "bye":
print(end) print(end)
elif frame['act'] == "pomoc":
print(help)
else: else:
print(unknown) print(unknown)

View File

@ -1,13 +1,14 @@
dialogue_state = [] dialogue_state = []
iterator = 1 iterator = 1
def monitor_stanu_dialogowego(frame): def monitor_stanu_dialogowego(frame, questions):
global iterator global iterator
# Some frames can reset the dialogue state, like saying hello. # Some frames can reset the dialogue state, like saying hello.
reset_state_if_needed(frame) reset_state_if_needed(frame)
singleState = { singleState = {
"iteration": iterator, "iteration": iterator,
"frame": frame "frame": frame,
"questions": questions
} }
dialogue_state.append(singleState) dialogue_state.append(singleState)
iterator += 1 iterator += 1

View File

@ -5,20 +5,18 @@ from generator_jezyka_nautalnego import generator_jezyka_nautalnego
def main(): def main():
running = True running = True
state = []
while running: while running:
text = input('>>>') text = input('>>>')
frame = analizator_jezyka_naturalnego(text) frame = analizator_jezyka_naturalnego(text)
print("[INFO] - Analizator: {}".format(frame))
state = monitor_stanu_dialogowego(frame) questions = taktyka_dialogu(frame)
print("[INFO] - Liczba elementów stanu: {}".format(len(state)))
questions = taktyka_dialogu(state, frame) state = monitor_stanu_dialogowego(frame, questions)
print("[INFO] - Taktyka: {}".format(questions))
generator_jezyka_nautalnego(frame, questions) generator_jezyka_nautalnego(frame, questions, state)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -5,7 +5,7 @@ class Questions(Enum):
REPO = "repo" REPO = "repo"
NONE = "none" NONE = "none"
def taktyka_dialogu(state, frame): def taktyka_dialogu(frame):
return questions(frame) return questions(frame)
# TODO inna taktyka # TODO inna taktyka