Exemple #1
0
    def match(self, tagged_text: TaggedText) -> None:
        match = tagged_text.match_regex(r"called (.*)")

        if match:
            self.task_name = match.group(1)
        else:
            uim = UserInputManager()
            self.task_name = uim.ask_for_name("tower")
Exemple #2
0
    def match(self, tagged_text : TaggedText) -> None:
        # match text until "with" or "corners" is encountered
        match = tagged_text.match_regex(r"called (.*?)(?= with| corners)")

        if match:
            self.area_name = match.group(1)
        else:
            uim = UserInputManager()
            self.area_name = uim.ask_for_name("area")

        # match eight digits for area corners
        regex_pos_list = [("corners", "NN")] + ([(r".*", "CD")] * 8)
        matches = tagged_text.match_regex_pos_list(regex_pos_list)

        for i in range(1, len(matches), 2):
            coord_x = nlp.get_int(matches[i].string)
            coord_y = nlp.get_int(matches[i+1].string)
            corner = db.onto.Location(x=coord_x, y=coord_y, z=0)

            setattr(self, f"corner_{i // 2}", corner)