Пример #1
0
 def execute_for_command(self, skill_input: SkillInput, user_interaction_service: UserInteractionServiceBase):
     """Executes this skill on the given command input."""
     verb_object = skill_input.noun
     alternate_noun = skill_input.noun # TODO: Actually get the correct alternate noun.
     new_name = alternate_noun or verb_object
     if new_name:
         settings.set_username(new_name)
         user_interaction_service.speak(f"Pleased to meet you, {settings.username}!", True)
         return True
     else:
         return False
Пример #2
0
 def execute_for_command(
         self, skill_input: SkillInput,
         user_interaction_service: UserInteractionServiceBase):
     """Executes this skill on the given command input."""
     adjective = skill_input.adj.lower()
     voice = adjective
     if voice in ("female", "male"):
         settings.set_voice(voice)
         user_interaction_service.speak(
             'Okay, I will use a %s voice from now on.' % (voice), True)
     else:
         user_interaction_service.speak(
             'I don\'t understand what voice you want')
Пример #3
0
 def execute_for_command(
         self, skill_input: SkillInput,
         user_interaction_service: UserInteractionServiceBase):
     """Executes this skill on the given command input."""
     verb_object = skill_input.dependencies.noun or skill_input.dependencies.propn
     if verb_object is None:
         user_interaction_service.speak(
             "I couldn't understand what website you want to open.")
         return
     requested_site_name = verb_object.lower()
     site_name = ""
     site_url = ""
     if requested_site_name in [
             'bannerweb', 'banner', 'registration', 'financial aid'
     ]:
         site_name = "BannerWeb"
         site_url = "https://www.ltu.edu/bannerweb"
     elif requested_site_name in ['blackboard', 'bb']:
         site_name = "BlackBoard"
         site_url = "https://my.ltu.edu"
     elif requested_site_name in ['library', 'ltu library']:
         site_name = "the LTU Library homepage"
         site_url = "https://www.ltu.edu/library"
     elif requested_site_name in [
             'help desk', 'helpdesk', 'tech support', 'ehelp'
     ]:
         site_name = "the LTU eHelp homepage"
         site_url = "http://www.ltu.edu/ehelp/"
     elif requested_site_name in ['password', 'mypassword']:
         site_name = "MyPassword web service"
         site_url = "https://mypassword.campus.ltu.edu/"
     elif requested_site_name in ['ltu.edu', 'ltu website', 'ltu homepage']:
         site_name = "the main LTU website"
         site_url = "http://www.ltu.edu"
     elif requested_site_name in ['email', 'webmail', 'mail', 'gmail']:
         site_name = "Gmail"
         site_url = "https://gmail.com"
     elif requested_site_name in ['calendar', 'schedule', 'events']:
         site_name = "Google Calendar"
         site_url = "https://calendar.google.com"
     elif requested_site_name in ['ltu events', 'ltu event']:
         site_name = "ltu events"
         site_url = "http://www.ltu.edu/myltu/calendar.asp"
     else:
         user_interaction_service.speak(
             "I don't recognize the website you want to open.")
         return
     self.__open_site(site_name, site_url, user_interaction_service,
                      skill_input.verbose)
Пример #4
0
def process_command(interaction_service: UserInteractionServiceBase,
                    optional_message: str = None):
    """Processes a command, either supplied as a parameter or obtained from
    user interaction."""
    if optional_message:
        sentence = optional_message
        print(f"Text input provided: {optional_message}")
    else:
        (success,
         sentence) = interaction_service.greet_user_and_ask_for_command(
             settings.username.capitalize())
        if not success:
            interaction_service.tell_user_could_not_be_heard(speak_service)
            return
    ud = Parse(sentence)
    if not assistantdb.identify_and_run_command(ud, interaction_service):
        interaction_service.tell_user_command_was_not_understood(speak_service)
Пример #5
0
    def execute_for_command(
            self, skill_input: SkillInput,
            user_interaction_service: UserInteractionServiceBase):
        """Executes this skill on the given command input."""
        verb_object = skill_input.noun
        room_str = verb_object
        finder_message = ''
        if room_str:
            words = room_str.split()
            if words[0] == "room":
                words.remove("room")
            if not len(words) or len(words[0]) not in range(4, 6):
                finder_message = 'Sorry, but I don\'t think you told me which room you want.'
            # TODO: Use a regular expression for better room number validity
            else:
                print(words)
                room_letter = words[0][0].upper()
                room_floor = words[0][1]
                building_dict = {
                    'A': 'Architecture Building',
                    'B': 'Business Services Building',
                    'C': 'A. Alfred Taubman Student Services Center',
                    'D': 'Art and Design Center',
                    'F': 'CIMR Building',
                    'E': 'Engineering Building',
                    'R': 'Ridler Field House and Applied Research Center',
                    'M': 'Wayne H. Buell Management Building',
                    'S': 'Arts and Sciences Building',
                    'T': 'University Technology and Learning Center'
                }
                if room_letter in building_dict.keys():
                    building = building_dict[room_letter]
                else:
                    building = ''

                if building != '':
                    finder_message = 'Your room is in the ' + building + ' on floor ' + room_floor + '.'
                else:
                    finder_message = 'Sorry, I don\'t know which building that is.'
        else:
            finder_message = 'Sorry, but I don\'t think you told me which room you want.'
        user_interaction_service.speak(finder_message, skill_input.verbose)
Пример #6
0
 def execute_for_command(self, skill_input: SkillInput, user_interaction_service: UserInteractionServiceBase):
     """Executes this skill on the given command input."""
     event_list = calendardb.get_todays_events()
     if len(event_list) < 1:
         output_str = 'There are no events currently scheduled.'
     elif len(event_list) == 1:
         output_str = ' '.join(['You only have', event_list[0].event_str, 'at',
                             event_list[0].start_time_str]) + '.'
     elif len(event_list) == 2:
         output_str = ' '.join(['You have', event_list[0].event_str, 'at',
                             event_list[0].start_time_str, 'and',
                             event_list[1].event_str, 'at',
                             event_list[1].start_time_str]) + '.'
     else:
         # 3 or more events
         output_str = 'You have '
         for event in event_list[:-1]:
             output_str += ' '.join([event.event_str, 'at',
                                     event.start_time_str]) + ', '
         output_str += ' '.join(['and', event_list[-1].event_str, 'at',
                                 event_list[-1].start_time_str]) + '.'
     user_interaction_service.speak(output_str, skill_input.verbose)
Пример #7
0
 def execute_for_command(
         self, skill_input: SkillInput,
         user_interaction_service: UserInteractionServiceBase):
     """Executes this skill on the given command input."""
     verb_object = skill_input.noun
     event_str = verb_object
     if event_str == 'event':
         event_sentence = user_interaction_service.ask_question(
             'Okay, what is the event called?', skill_input.verbose)
         day_sentence = user_interaction_service.ask_question(
             'What day will this be on?', skill_input.verbose)
         time_sentence = user_interaction_service.ask_question(
             'What time will this start at?', skill_input.verbose)
         cal_event = calendardb.CalendarEvent(event_sentence, day_sentence,
                                              time_sentence, '')
         calendardb.add_event(cal_event)
         feedback_sentence = 'Alright, I\'m putting down ' + str(
             cal_event) + '.'
         user_interaction_service.speak(feedback_sentence,
                                        skill_input.verbose)
     else:
         user_interaction_service.speak(
             'Sorry, I am unable to help you schedule this right now.',
             skill_input.verbose)
Пример #8
0
 def __open_site(self, site_name: str, site_url: str,
                 user_interaction_service: UserInteractionServiceBase,
                 verbose: bool):
     """Announces opening a site and then actually opens it."""
     user_interaction_service.speak(f"Opening {site_name}...", verbose)
     webbrowser.open(site_url)
Пример #9
0
 def execute_for_command(self, skill_input: SkillInput, user_interaction_service: UserInteractionServiceBase):
     """Executes this skill on the given command input."""
     user_interaction_service.speak(f"It is currently {calendardb.get_current_date()}.", True)