2
I’m having trouble with the Python library, specifically the Chatbot, the error is as follows:
from chatterbot import Chatbot
ImportError: cannot import name 'Chatbot' "
Here is my code:
from chatterbot import Chatbot
import pyttsx
import speech_recognition as sr
en = pyttsx.init()
en.setProperty('voice',b'brazil')
rec = sr.Recognizer()
class BotFalante(Chatbot):
def escuta(self,frase=None):
try:
with sr.Microphone() as mic:
fala = rec.listen(mic)
frase = rec.recognize_google(fala,language='pt')
frase = frase.replace('aprendi','aprende')
print(frase)
except sr.UnknownValueError:
print('Deu erro na identificação')
return ('')
return super().escuta(frase=frase)
def fala(self,frase):
en.say(frase)
en.runAndWait()
super().fala(frase)
Bot = BotFalante('Zuleide')
while True:
frase = Bot.escuta()
resp = Bot.pensa(frase)
Bot.fala(resp)
if resp == ('falou'):
break
Have you installed chatbot? with Pip install chatterbot ? Take a look here: https://chatterbot.readthedocs.io/en/stable/tutorial.html
– Marcos Marques
i installed with sudo pip3 install chatterbot (Ubuntu use)
– kingarthur
because it checks if it is installed python -m chatterbot --version. If it is not and uses umbunto it uses the command. pip3 install git+git://github.com/gunthercox/Chatterbot.git@master
– Marcos Marques
when I give the command python -m chatterbot --version. , back it up: /usr/bin/python: In the module named chatterbot, even if I already installed the same
– kingarthur
then the module is not installed. A tip I can give to help you. Installs Anaconda in unbuntu. You will avoid these installation and release problems. https://www.anaconda.com/download/#linux
– Marcos Marques