Пример #1
0
    def explain_goal(self, goal_idx):
        """Explain what a goal number means."""
        if self._spec_lists:
            goal_spec_chunk = goal_to_chunk(goal_idx, self._spec_lists)
            if goal_spec_chunk:
                return "I'm currently trying to carry out {!r}".format(goal_spec_chunk.explanation)

        # If we can't find anything, give up.
        return "Sorry, but I don't know anything about goal {!r}.".format(goal_idx)
Пример #2
0
    def explain_goal(self, goal_idx):
        """Explain what a goal number means."""
        if self._spec_lists:
            goal_spec_chunk = goal_to_chunk(goal_idx, self._spec_lists)
            if goal_spec_chunk:
                return "I'm currently trying to carry out {!r}".format(
                    goal_spec_chunk.explanation)

        # If we can't find anything, give up.
        return "Sorry, but I don't know anything about goal {!r}.".format(
            goal_idx)
Пример #3
0
    def tell(self, text, current_goal=None):
        """Tell the system something and return its response."""
        self.user_history.append(text)
        # Return the English of the current goal
        if self.gen_tree and current_goal:
            goal_spec_chunk = goal_to_chunk(current_goal, self.spec_lists)
            if goal_spec_chunk:
                response = "I'm currently trying to {!r}".format(goal_spec_chunk.explanation)
            else:
                response = "Sorry, but I don't know anything about goal {!r}.".format(current_goal)
        else:
            response = "Thank you for sharing."

        self.system_history.append(response)
        return response