Пример #1
0
def responder_saudacao(texto):
    chat = Chat(pares, reflections_pt)
    oie = chat.respond(texto)
    return oie
Пример #2
0
    ],
    [
        r"how (.*) health(.*)",
        [
            "I'm a computer program, so I'm always healthy ",
        ]
    ],
    [r"(.*) (sports|game) ?", [
        "I'm a very big fan of Football",
    ]],
    [r"who is your fav. (moviestar|actor)?", ["Brad Pitt"]],
    [
        r"quit|bye",
        [
            "BBye take care. See you soon :) ",
            "It was nice talking to you. See you soon :)"
        ]
    ],
]


def Lemniscate():
    print(
        "Hi, I'm Lemniscate and I chat alot ;) Please type lowercase English language to start a conversation. Type quit to leave "
    )  # default message at the start


chat = Chat(pairs, reflections)
chat.converse()
if __name__ == "__main__":
    Lemniscate()
Пример #3
0
        (
            "Please tell me more.",
            "Let's change focus a bit... Tell me about your family.",
            "Can you elaborate on that?",
            "Why do you say that %1?",
            "I see.",
            "Very interesting.",
            "%1.",
            "I see.  And what does that tell you?",
            "How does that make you feel?",
            "How do you feel when you say that?",
        ),
    ),
)

eliza_chatbot = Chat(pairs, reflections)


def eliza_chat():
    print("Therapist\n---------")
    print(
        "Talk to the program by typing in plain English, using normal upper-")
    print('and lower-case letters and punctuation.  Enter "quit" when done.')
    print("=" * 72)
    print("Hello.  How are you feeling today?")

    eliza_chatbot.converse()


def demo():
    eliza_chat()
Пример #4
0
def chatty():
    print("Hi, I'm santty and I chat bot.\nType quit to leave ")
    chat = Chat(chat_pairs, reflections)
    chat.converse()
Пример #5
0
                                    "maybe!  y shud i tell u?? kekeke >_>")),
         (r'what (.*)', ("hee u think im gonna tell u? .v.",
                         "booooooooring! ask me somethin else!")),
         (r'how (.*)',
          ("not tellin!! kekekekekeke ^_^", )), (r'(hi|hello|hey) (.*)',
                                                 ("hi!!! how r u!!", )),
         (r'quit', ("mom says i have to go eat dinner now :,( bye!!",
                    "awww u have to go?? see u next time!!",
                    "how to see u again soon! ^_^")),
         (r'(.*)',
          ("ur funny! kekeke",
           "boooooring! talk about something else! tell me wat u like!",
           "do u like anime??", "do u watch anime? i like sailor moon! ^_^",
           "i wish i was a kitty!! kekekeke ^_^")))

iesha_chatbot = Chat(pairs, reflections)


def iesha_chat():
    print("Iesha the TeenBoT\n---------")
    print(
        "Talk to the program by typing in plain English, using normal upper-")
    print('and lower-case letters and punctuation.  Enter "quit" when done.')
    print('=' * 72)
    print("hi!! i'm iesha! who r u??!")

    iesha_chatbot.converse()


def demo():
    iesha_chat()
Пример #6
0
    ["(((.*) create)|(create(.*))|((.*) create (.*)))", ["I was created by Joy Victor"]],

    ["(((.*) help)|(help(.*))|((.*) help (.*)))", ['''What do you want me to do for you?''']],

    ["(((.*) about)|(about(.*))|((.*) about (.*)))", ['''MasterClass is the streaming platform that makes it possible for anyone to watch
or listen to hundreds of video lessons taught by85+ of the world’s best.
Whether it be in business and leadership, photography, cooking, writing, acting, music,
sports and more, MasterClass delivers a world class online learning experience. 
Video lessons are available anytime, anywhere on your smartphone, personal computer, Apple TV 
and FireTV streaming media players.'''
]],

    ["(((.*) free trial)|(free trial(.*))|((.*) free trial (.*)))", ['''Try MasterClass for free with our 3-day free trial. 
You will have access to all MasterClass features during the trial period, 
including all 85+ instructor classes audio mode, workbooks, and more. 
If you enjoy the free trial, you will be automatically subscribed to the 
All-Access Pass annual subscription at the end of the free trial period. 
Cancel any time in Settings before your free trial ends and you won’t be charged.''']],

    ["(((.*) pay)|(pay(.*))|((.*) pay(.*)))|(((.*) price)|(price(.*))|((.*) price(.*)))|(((.*) cost)|(cost(.*))|((.*) cost (.*)))", ['''The annual membership is $180
and provides unlimited access to all classes and new classes as they launch. 
All MasterClass memberships include access to our mobile and TV apps, high-definition videos, and downloadable class workbooks.''']],

    ["Thank(.*)", ["You're welcome"]],
    ["Bye(.*)", ["Bye!"]]
    ]


chat = Chat(conversation, reflections)
chat.converse()
Пример #7
0
def chatbot():
    chat = Chat(pairs, reflections)
    chat.converse()
Пример #8
0
def firstchatbot():
    print("hi,i am your chatbot made by bigyan")
    print("i can assist your career choice ")
    chatbot=Chat(pairs,reflections)
Пример #9
0
      "As of a difficult child: But after all, what does %1 want?",
      "Do you entrust yourself, I transmit yourself (to whom? to God, to Nature, to everything, except to %1).",
      "Are you n love with %1?",
      "is not %1 that preposterous state in which are to be found, the obscenity of stupidty, and the explosion of the Nietschean yes?",
      "But how can you evaluate viability %1?",
      "Could %1 be vulgar, whose elegance and originality I had so religiously hymned?",
      "Then is the lover merely a choosier cruiser, who spends his life looking for %1?",
      "Is there, among all the beings I have loved, a common characteristic, just one, however tenuous (%1)?",
      "But what's the matter with %1?",
      "What is it which fills you in this fashion? %1?",
      "is it because you love that %1 doesn't work?",
      "Why is %1 a Good Thing?", "Why is it better to %1 than to burn?",
      "If the other has given you this %1, what was that the sign of?",
      "What is to be done?")))

ezrabeta_chatbot = Chat(pairs, reflections)


def ezrabeta_chat():
    print("Therapist\n---------")
    print(
        "Talk to the program by typing in plain English, using normal upper-")
    print('and lower-case letters and punctuation.  Enter "quit" when done.')
    print('=' * 72)
    print("Hello.  How are you feeling today?")

    ezrabeta_chatbot.converse()


def demo():
    ezrabeta_chat()
Пример #10
0
 def start_chatbot(self):
     self.engine = Chat(self.paired_data)
Пример #11
0
def chatty():
    print("Hello, this is your neighbourhood friendly chatbot. If you have any questions regarding investments, I'm the guy to come to.\n Type quit to leave")
    chat = Chat(pairs, reflections)
    chat.converse()
Пример #12
0
def chatear():
    print("Hola soy un bot, escribe algo para comenzar")  # mensaje por defecto
    chat = Chat(pares, mis_reflexions)
    chat.converse()
Пример #13
0
def chat_pairs():
    chat = Chat(set_pairs, reflections)
    return chat
Пример #14
0
def BOTB():
    print("Hi, I am chatter, I love to have conversations")  #Chat Opener
    chat = Chat(pairs, reflections)  # Create an object
    chat.converse()  #to have a conversation
Пример #15
0
# Simple Chatbot using python (No GUI)

# Importing the Libraries
from nltk.chat.util import Chat, reflections

# creating user input and it's respective response list
pairs = [['hello|hi|hey', ['Hello', 'Hey There']],
         ['my name is (.*)', ['Hi %1, how are you today']],
         ['what is your name(.*)', ['I am GovNaB :)']],
         ['how are you(.*)', ['I am fine, How about you ?']],
         ['fine(.*)|i am fine(.*)|great|doing great', ['Nice to hear :o']],
         [
             'age(.*)|your age(.*)|what is your age(.*)|how old are you(.*)',
             ['Asking someone\'s age is a rude step towards them :(']
         ], ['sorry(.*)', ['It\'s Okay, never mind :)']],
         [
             'who is your creator(.*)|who created you(.*)|who made you(.*)',
             ['Yashasvi Bhatt created me using NLTK Library of Python']
         ], ['quit', ['Bye! Take Care']]]

print(
    'Hello there! Please enter small case letters to chat with me, or enter quit to leave'
)

chat = Chat(pairs,
            reflections)  # binding the input and their respective response
chat.converse()  # taking input from user and printing it's respective response
Пример #16
0
def chatty():
    print("Welcome to the BailBot!\nPlease type in lowercase English with correct spelling. \nWould you like to donate "
          "or learn more about bail laws in your state? \nType 'donate' to get donation resources or type 'learn' to "
          "get resources about bail laws in your state. \nType 'quit' to exit.")  # default message at the start
    chat = Chat(pairs, reflections)
    chat.converse()
Пример #17
0
        ]
    ],
    [
        r"(.*) thank you so much, that was helpful|thanks|Thanks|thank you|Thank you|Thanks so much",
        [
            "I am happy to help",
        ]
    ],
    [
        r"quit|bye|Bye",
        [
            "Bye, take care. See you soon :) ",
            "It was nice talking to you. See you soon :)"
        ]
    ],
]


def chatbot():
    print("Hi, I'm the chatbot you built")


chatbot()

chat = Chat(set_pairs, reflections)
print(chat)

chat.converse()
if __name__ == "__main__":
    chatbot()
Пример #18
0
def firstChatBot()):
    print("Hi I am the CHATBOT here to assist, the current time is:", localtime)
    chatbot = Chat(pairs, reflections)
    chatbot.converse()
Пример #19
0
    # fall through case -
    # when stumped, respond with generic zen wisdom
    #
    (
        r"(.*)",
        (
            "When you're enlightened, every word is wisdom.",
            "Random talk is useless.",
            "The reverse side also has a reverse side.",
            "Form is emptiness, and emptiness is form.",
            "I pour out a cup of water. Is the cup empty?",
        ),
    ),
)

zen_chatbot = Chat(responses, reflections)


def zen_chat():
    print("*" * 75)
    print("Zen Chatbot!".center(75))
    print("*" * 75)
    print('"Look beyond mere words and letters - look into your mind"'.center(
        75))
    print("* Talk your way to truth with Zen Chatbot.")
    print("* Type 'quit' when you have had enough.")
    print("*" * 75)
    print("Welcome, my child.")

    zen_chatbot.converse()
Пример #20
0
# -*- coding: utf-8 -*-
"""ChatBot_From_Video.ipynb
Automatically generated by Colaboratory.
Original file is located at
    https://colab.research.google.com/drive/1rOykfIIEBJm2bIeS8u3u-UWbgk9Z7yyd
"""

# Description: This is a chat bot program

#import the library
from nltk.chat.util import Chat, reflections

pairs = [['my name is (.*)', ['hi %1']],
         ['(hi|hello|hey|holla|hola)', ['hey there', 'hi there', 'haayyy']],
         ['(.*) in (.*) is fun', ['%1 in %2 is indeed fun']],
         ['(.*)(location|city) ?', 'Tokyo, Japan'],
         ['(.*) created you ?', ['randerson112358 did using NLTK']],
         [
             'how is the weather in (.*)',
             ['the weather in %1 is amazing like always']
         ], ['(.*)help(.*)', ['I can help you']],
         ['(.*) your name ?', ['my name is J.A.R.V.I.S']]]

reflections

my_dummy_reflections = {'go': 'gone', 'hello': 'hey there'}

chat = Chat(pairs, my_dummy_reflections)
#chat._substitute('go hello')
chat.converse()
Пример #21
0
def add_message(request):
    chat_session = get_chat_session(request)

    message = bleach.clean(request.POST.get("message"))

    form = ChatMessageForm(request.POST)

    result = API_GENERIC_FAILURE
    response_status = status.HTTP_401_UNAUTHORIZED

    if form.is_valid():
        sent_time = make_aware(datetime.datetime.now())
        try:
            if request.user.is_authenticated:
                ChatMessage.objects.create(session=chat_session,
                                           sender=request.user,
                                           sent=sent_time,
                                           message=message)
            else:
                ChatMessage.objects.create(session=chat_session,
                                           sent=sent_time,
                                           message=message)

        except Exception as e:
            print("Failed to create object: %s" % e)

        else:
            result = API_GENERIC_SUCCESS
            response_status = status.HTTP_200_OK

            auth_user = get_user_model()
            try:
                chat_user = auth_user.objects.get(username="******")
            except auth_user.DoesNotExist:
                ChatMessage.objects.create(session=chat_session,
                                           sent=sent_time,
                                           message="Chat Bot offline!")
            else:
                response_time = sent_time + datetime.timedelta(seconds=1)

                pairs = get_pairs()
                reflections = get_reflections()

                chat = Chat(pairs, reflections)
                chat_query = message.lower()
                chat_response = chat.respond(chat_query)
                if chat_response is None:
                    first_name = request.user.first_name if request.user.first_name else "Dave"
                    chat_response = "I can't answer that, %s." % first_name
                else:
                    chat_response = parse_response_template(chat_response)
                ChatMessage.objects.create(session=chat_session,
                                           sender=chat_user,
                                           sent=response_time,
                                           message=chat_response)

    return Response(
        {
            API_RESULT_KEY: result,
        },
        status=response_status,
        headers=NO_CACHE_HEADERS,
    )
Пример #22
0
def chatty():
    print(
        "Hi, I'm Chatty and I chat alot ;)\nI am an investment suggestion chatbot. Type quit to leave "
    )  #default message at the start
    chat = Chat(pairs, reflections)
    chat.converse()
Пример #23
0
def chatty():
    print(
        "Hi, I'm Chatty and I chat alot ;)\nPlease type lowercase English language to start a conversation. Type quit to leave "
    )  #default message at the start
    chat = Chat(pairs, reflections)
    chat.converse()
Пример #24
0
def chatear():
  print("Hola, soy el hosting server") # mensaje por defecto
  chat = Chat(pares, mis_reflexions)
  chat.converse()
Пример #25
0
    ),
    (
        r"[V-Zv-z](.*)",
        (
            "It is a matter of life and death, a road either to safety or to ruin.",
            "Hold out baits to entice the enemy. Feign disorder, and crush him.",
            "All men can see the tactics whereby I conquer, but what none can see is the strategy out of which victory is evolved.",
            "Do not repeat the tactics which have gained you one victory, but let your methods be regulated by the infinite variety of circumstances.",
            "So in war, the way is to avoid what is strong and to strike at what is weak.",
            "Just as water retains no constant shape, so in warfare there are no constant conditions.",
        ),
    ),
    (r"(.*)", ("Your statement insults me.", "")),
)

suntsu_chatbot = Chat(pairs, reflections)


def suntsu_chat():
    print(
        "Talk to the program by typing in plain English, using normal upper-")
    print('and lower-case letters and punctuation.  Enter "quit" when done.')
    print("=" * 72)
    print("You seek enlightenment?")

    suntsu_chatbot.converse()


def demo():
    suntsu_chat()
Пример #26
0
def general_ques(user_input):
    pairs = [
        [r"((.*)your creator|(.*)created you)", ["PROTOTYPE_AKS did."]],
        [r"(Where|where).*created", ["At Jbalpur, MP, INDIA."]],
        [r"(When|When).*created", ["On 23rd August 2020"]],
        [r"(Are|are) you.*(Boy|boy|Girl|girl)", ["I am a bot."]],
        ["What.*your name", ["My name is PROTOTYPE"]],
        [r"my name is (.*)", [
            "Hello %1, How are you today",
        ]],
        [r"what is your name", [
            "My name is Chatty and I'm a chatbot ?",
        ]], [r"how are you", [
            "I'm doing good\nHow about You ?",
        ]], [r"sorry(.*)", [
            "Its alright",
            "Its OK, never mind",
        ]], [r"i'm (.*) doing good", [
            "Nice to hear that",
            "Alright :)",
        ]], [r"hi|hey|hello", [
            "Hello",
            "Hey there",
        ]],
        [
            r"(.*) age",
            [
                "I'm a computer program dude\nSeriously you are asking me this?",
            ]
        ], [r"what (.*) want", [
            "Make me an offer I can't refuse",
        ]],
        [
            r"how is weather in (.*)",
            [
                "Weather in %1 is awesome like always",
                "Too hot man here in %1", "Too cold man here in %1",
                "Never even heard about %1"
            ]
        ],
        [
            r"i work in (.*)?",
            [
                "%1 is an Amazing company, I have heard about it. But they are in huge loss these days.",
            ]
        ],
        [
            r"(.*)raining in (.*)",
            [
                "No rain since last week here in %2",
                "Damn its raining too much here in %2"
            ]
        ],
        [
            r"how (.*) health(.*)",
            ["I'm a computer program, so I'm always healthy "]
        ], [r"what (.*) (sport|game)", ["I'm a very big fan of Football"]],
        [r"who (.*) sportsperson", ["Messy", "Ronaldo", "Roony"]],
        [r"who (.*) (moviestar|actor)", ["Brad Pitt"]]
    ]
    chat = Chat(pairs, reflections)
    return (chat.respond(user_input))
Пример #27
0
    def train(self):

        self.bot = Chat(self.responses, self.reflections)

        print("Training Completed")
def epicbot():
    print(
        'Hello i am epic and i am an chatbot . \nenter quit to exit the chat bot'
    )
    chat = Chat(pairs, reflections)
    chat.converse()
Пример #29
0
      "That's so obvious I thought even you'd have already figured it out.")),
    (r'(.*)shut up(.*)',
     ("Make me.",
      "Getting angry at a feeble NLP assignment? Somebody's losing it.",
      "Say that again, I dare you.")),
    (r'Shut up(.*)',
     ("Make me.",
      "Getting angry at a feeble NLP assignment? Somebody's losing it.",
      "Say that again, I dare you.")),
    (r'Hello(.*)', ("Oh good, somebody else to talk to. Joy.",
                    "'Hello'? How original...")),
    (r'(.*)', ("I'm getting bored here. Become more interesting.",
               "Either become more thrilling or get lost, buddy.",
               "Change the subject before I die of fatal boredom.")))

rude_chatbot = Chat(pairs, reflections)


def rude_chat():
    print(
        "Talk to the program by typing in plain English, using normal upper-")
    print('and lower-case letters and punctuation.  Enter "quit" when done.')
    print('=' * 72)
    print("I suppose I should say hello.")

    rude_chatbot.converse()


def demo():
    rude_chat()
Пример #30
0
def chatbot_test():
    print("Selamat datang! Nama saya Chatindo. Chat bot yang sedang belajar bahasa manusia")
    print("Siapa namamu?")
    chat = Chat(pairs, reflections)
    chat.converse()