コード例 #1
0
                print(
                    'IMDBot: Sorry, I don\'t know which movie you\'re asking about to find the director. Try to ask me to find a movie :)'
                )  # if a movie is not being currently discussed, tell user it doesn't understand

        elif (sy.findSyns(user_input, 'character') == 0):
            if 'movie' in locals():
                movie = f.showCharacters(movie)
            else:
                print(
                    'IMDBot: Sorry, I don\'t know which movie you\'re asking about to list the characters. Try to ask me to find a movie first!'
                )

        elif (('who' in user_input) and ('played' in user_input)
              or ('voiced' in user_input)):
            if 'movie' in locals():
                person = f.whoPlayed(userName, movie, person_name, movie_name)
            else:
                person = f.whoPlayed(userName, '', person_name, movie_name)

        elif (sy.findSyns(user_input, 'change') == 0
              and ('name' in user_input or 'username' in user_input)):
            userName = u.checkName(userName)
            print('How can I help you?'
                  )  #concatenates to "IMDBot: That's a cool name, userName! "

        elif ('what' in user_input
              and ('other' in user_input or 'another' in user_input)):
            #takes in user input and calls otherRoles() from person.py
            if 'person' in locals():
                print("IMDBot: Hmm... let me think...")
                p.otherRoles(person)  # Takes person object
コード例 #2
0
ファイル: IMDBot.py プロジェクト: KaranGohil/Group-4-Project
 elif (user_input.lower().__contains__('characters')):
     if 'movie' in locals():
         movie = f.showCharacters(movie)
     else:
         print(
             'IMDBot: Sorry, I don\'t know which movie you\'re asking about to list the characters. Try to ask me to find a movie first!'
         )
 elif (user_input.lower().__contains__('who played')):
     if 'movie' in locals():
         character = user_input.split(
             'played '
         )[1]  #if user writes 'who played neo in matrix' cuts to 'neo in matrix'
         character = character.split(
             ' '
         )[0]  #continues to cut the string. now it is 'neo'. this might be problematic because it is only looking at the first name
         person = f.whoPlayed(movie, character)
     else:
         print(
             'IMDBot: Sorry, I need to know which movie you\'re talking about first. Please ask me to look up a movie first.'
         )
 elif (user_input.lower().__contains__('how long')
       or user_input.lower().__contains__('runtime')):
     if 'movie' in locals():
         movie = f.runtime(movie)
     else:
         print(
             'IMDBot: Sorry, I need to know which movie you want me to check the runtime for. Please ask me to find a movie first.'
         )
 elif (user_input.lower().__contains__('change' and 'name')):
     userName = u.checkName(userName)
     print('How can I help you?'