Initial commit
This commit is contained in:
commit
ab37136896
42
chatbot.py
Normal file
42
chatbot.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user