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!'
unknown = "Nie rozumiem."
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:
#ask additional questions
if question == Questions.TIME:
print("Z jakiego czasu?")
elif state[-2]['questions'] != Questions.NONE and frame['act'] != "":
print("Przyjęto odpowiedź na pytanie.")
else:
#dont ask questions
if frame['act'] == "hello":
print(welcome)
elif frame['act'] == "bye":
print(end)
elif frame['act'] == "pomoc":
print(help)
else:
print(unknown)

View File

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

View File

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

View File

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