Initial commit

This commit is contained in:
Jakub Kaczmarek 2022-03-09 13:07:13 +01:00
commit ab37136896
1 changed files with 42 additions and 0 deletions

42
chatbot.py Normal file
View File

@ -0,0 +1,42 @@
from nltk.chat.util import Chat
reflections = {
"jestem": "jestes",
"byłem": "byłeś",
"ja": "ty",
"zrobiłbym": "zrobiłbyś",
"zrobiłem": "zrobiłeś",
"zrobię": "zrobisz",
"mam": "masz",
"twoje": "moje",
"twój": "mój",
"ty": "ja",
}
pairs = (
(
r'Potrzebuje (.*)',
(
"Dlaczego potrzebujesz %1?",
"Czy napewno %1 Ci pomoże?",
"Jesteś pewny, że potrzebujesz %1?",
),
),
(
r"Why can\'t I (.*)",
(
"Do you think you should be able to %1?",
"If you could %1, what would you do?",
"I don't know -- why can't you %1?",
"Have you really tried?",
),
),
)
chatbot = Chat(pairs, reflections)
if __name__ == '__main__':
print('Cześć, czegopotrzebujesz?')
chatbot.converse()