Example #1
0
 def do_POST(self):
     self.send_response(200)
     content_length = int(self.headers['Content-Length'])
     post_body = self.rfile.read(content_length)
     self.end_headers()
     print('user query', post_body)
     google_search_chatbot_reply = chatbot_query(post_body)
     self.wfile.write(str.encode(google_search_chatbot_reply))
Example #2
0
 def do_POST(self):
     self.send_response(200)
     content_length = int(self.headers['Content-Length'])
     post_info = self.rfile.read(content_length)
     self.end_headers()
     print('Informacao Pesquisada :', post_info)
     Exemplo_chatBot = chatbot_query(post_info)
     self.wfile.write(str.encode(Exemplo_chatBot))
Example #3
0
def main():
    listtext=[]
    dict_username={}
    username=''
    with open('user.txt', 'w') as file:
        
        username=input('Bot: Hi What is your Name\nUser: '******'Bot: What would you like to do ', username)
        dict_username=read(username)
        username=username.lower()
        file.write(username)


        
        userinss=input('User: '******'':
            userinss=input('User: '******'quit':
                break    
       #write ti username dicitonar
        listtext.append(userinss)
        file.write(userinss)
        Flag=True

        tokens,short_sent= editor(userinss)
    
    
        Fallback_company='no company Info '
        while Flag:
        

            tokens,short_sent= editor(userinss)

            val=determiner(short_sent)
        
       
            if val==2:
                return_val,listtext= Learn(short_sent,listtext)
                if return_val==-1:
                    print('Company not found ')
                if return_val==-2:
                    print('string was empty ')
           
            elif val==3:
                basic(short_sent)
            elif val==4:
                print(chatbot_query(short_sent))

            userinss=input('user:'******'':
                print('please type something')
                userinss=input('user:'******'quit':
                Flag=False
        
    print(listtext)
    print('Bye Have a good day')
    dict_username[username].append(listtext)
    with open('username.pickle', 'wb') as handle:
        pickle.dump(dict_username, handle, protocol=pickle.HIGHEST_PROTOCOL)

    print(dict_username)