Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from chatterbot import ChatBot
import speech_recognition as sr
from chatterbot.trainers import ListTrainer
r = sr.Recognizer()
bot = ChatBot('Darwin' , input_adapter="chatterbot.input.VariableInputTypeAdapter")
conv = open('chat_text.txt' , 'r').readlines()
bot.set_trainer(ListTrainer)
bot.train(conv)
while True: ##Audio input , conversion to text , inputs text to the chatbot
with sr.Microphone() as source:
print("tell me something ")
audio = r.listen(source)
try:
text = r.recognize_google(audio)
print(text)
request = text ## error , request won't accept the variable text as input ( text stores the audio input converted into text)
response = bot.get_response(request)
print('Bot:', response)