from wolframAPI import wolframQuestion import wolframalpha import film as f import person as p import company as c import user as u import ner import spellinghandler as sp import synonyms as sy import postagging as pt from chatterbot import ChatBot bot = ChatBot('MovieBot') print('IMDBot: Hello There! My name is IMDBot. ', end='') userName = u.askForName() #set username for the first time print(f'IMDBOT: I just want to make sure I have your name right.') userName = u.checkName( userName ) #check username if correct. method can also be used if user wants to change their username print(f'I am a bot who knows all about movies. How can I help you today?' ) #concatenates to "IMDBot: That's a cool name, userName! " while True: try: raw_user_input = input( f'{userName}: ') #collect user input for this iteration. entities = ner.listEntities(raw_user_input) movie_name = ner.getMovieName(raw_user_input) person_name = ner.getPersonName(raw_user_input) company_name = ner.getOrgName(raw_user_input)
def test_askForName(self, mock_input): self.assertEqual(u.askForName(), 'Sam')