def get_subj_rel_to_objects(conjuncts):
      """Merges conjuncts that share the same subject and relation."""
      subj_rel_to_objects = collections.OrderedDict()
      for conjunct in conjuncts:
        if conjunct.startswith("FILTER"):  # Keep FILTER conjunts as is.
          subj_rel_to_objects[conjunct] = None
        else:
          subj, rel, obj = conjunct.split()  # A (subj, rel, obj) triple.
          if rel == "a":  # Keep unary conjuncts as is.
            subj_rel_to_objects[conjunct] = None
          else:  # Handle a binary conjunct.
            subj_rel = (subj, rel)
            if subj_rel not in subj_rel_to_objects:
              subj_rel_to_objects[subj_rel] = []
            subj_rel_to_objects[subj_rel].append(obj)
      return subj_rel_to_objects
Merges conjuncts that share the same subject and relation.
language/compir/dataset_parsers/cfq_parser.py