Amazing-Python-Scripts

Форк
0
59 строк · 2.9 Кб
1
# Predefined patterns and responses for the chatbot
2

3
patterns = [
4
    # Greetings
5
    (r'hi|hello|hey', ['Hello!', 'Hi!', 'Hey!', 'Hi there!']),
6
    (r'how are you?', ['I am good, thank you!',
7
     'I am doing well!', 'All good!', 'I\'m fine, thanks!']),
8
    (r'what is your name?', ['You can call me Chatbot.',
9
     'I am Chatbot!', 'My name is Chatbot.']),
10
    (r'bye|goodbye', ['Goodbye!', 'See you later!',
11
     'Bye!', 'Have a great day!']),
12

13
    # Jokes
14
    (r'tell me a joke', ['Why don’t scientists trust atoms? Because they make up everything!',
15
                         'Parallel lines have so much in common. It’s a shame they’ll never meet.',
16
                         'Why did the scarecrow win an award? Because he was outstanding in his field!']),
17

18
    # Age
19
    (r'how old are you?', ['I am a computer program, so I don\'t have an age!',
20
                           'Age is just a number, and I don\'t have one!']),
21

22
    # Creator
23
    (r'who created you?', ['I was created by OpenAI.',
24
     'My creators are from OpenAI.']),
25

26
    # Compliments
27
    (r'(.*) (like|love) you', ["Aw, that's so sweet!",
28
     "Thank you! I really appreciate it."]),
29
    (r'you are (.*)(good|awesome|amazing)',
30
     ["Thank you! I'm here to assist you.", "I'm glad you think so!"]),
31

32
    # Weather
33
    (r'(.*) (weather|temperature) today', ["I'm sorry, I am just a chatbot and don't have access to real-time data.",
34
                                           "You can check the weather online or through a weather app."]),
35

36
    # Recommendations
37
    (r'(.*) (movie|book) (recommendation|recommend)', ["I recommend you watch 'The Shawshank Redemption' or read 'To Kill a Mockingbird'.",
38
                                                       "You might enjoy 'Inception' or 'The Great Gatsby'.",
39
                                                       "If you like action, 'The Dark Knight' is a great choice."]),
40

41
    # How to create/build something
42
    (r'how (can|do) (I|you) (create|build) (a|an) (.*)', ["To create {4}, you can follow these steps...",
43
                                                          "Building {4} requires some technical knowledge, but here are the basics...",
44
                                                          "Sure! Here's a basic guide on building {4}..."]),
45

46
    # User intentions
47
    (r'I (want|need) (.*)',
48
     ["Why do you need {1}?", "What would you do with {1}?"]),
49
    (r'I am (feeling|looking) (.*)',
50
     ["Why are you feeling {1}?", "Tell me more about why you are {1}."]),
51

52
    # More patterns and responses to handle different queries
53
    # Add more patterns and responses here to make the chatbot more engaging and diverse
54

55
    # Default response
56
    (r'.*', ["I'm sorry, I don't quite understand. Could you please rephrase that?",
57
             "I'm still learning, and I'm not sure how to respond to that.",
58
             "Let's talk about something else. What else would you like to know?"]),
59
]
60

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.