Problems with python libraries, ChatBot

0

I'm having problems in the Python library, specifically 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
    
asked by anonymous 29.10.2018 / 20:04

1 answer

0

You have named your chatterbot from chatterbot.py and then imported from chatterbot it changes its name to any other one and should work.

    
29.10.2018 / 20:13