def _bracket_complex_action(self, utterance, category):
    """Wraps complex actions (separated by "and"/"after") with parentheses."""
    utterance_parts = utterance.split(" {} ".format(category))
    program_parts_bracketed = [
        self._bracket_atomic_action(utterance_part,
                                    self.atom_map[utterance_part])
        for utterance_part in utterance_parts
    ]
    if category == "and":
      return "( {} ) ( {} )".format(program_parts_bracketed[0],
                                    program_parts_bracketed[1])
    else:
      return "( {} ) ( {} )".format(program_parts_bracketed[1],
                                    program_parts_bracketed[0])
Wraps complex actions (separated by "and"/"after") with parentheses.
language/compir/dataset_parsers/scan_parser.py