def query2box_generator():
      """Convert query2box features to EmQL features.

      We simply hard-code their input format for parsing, since there's not
      a simple way to automatically serialized to our input format.

      Yields:
        a tuple of features and label
      """
      for query in data:
        if task == '1c':
          assert len(query) == 1
          ent, rels = query[0]
          yield (convert_entid(ent), convert_relid(rels[0])), 0
        elif task == '2c':
          assert len(query) == 1
          ent, rels = query[0]
          yield (convert_entid(ent),
                 convert_relid(rels[0]),
                 convert_relid(rels[1])), 0
        elif task == '3c':
          assert len(query) == 1
          ent, rels = query[0]
          yield (convert_entid(ent),
                 convert_relid(rels[0]),
                 convert_relid(rels[1]),
                 convert_relid(rels[2])), 0
        elif task == '2i' or task == '2u':
          assert len(query) == 2
          ent1, rels1 = query[0]
          ent2, rels2 = query[1]
          yield (convert_entid(ent1), convert_relid(rels1[0]),
                 convert_entid(ent2), convert_relid(rels2[0])), 0
        elif task == '3i':
          assert len(query) == 3
          ent1, rels1 = query[0]
          ent2, rels2 = query[1]
          ent3, rels3 = query[2]
          yield (convert_entid(ent1), convert_relid(rels1[0]),
                 convert_entid(ent2), convert_relid(rels2[0]),
                 convert_entid(ent3), convert_relid(rels3[0])), 0
        elif task == 'ic' or task == 'uc':
          assert len(query) == 3
          ent1, rels1 = query[0]
          ent2, rels2 = query[1]
          rel3 = query[2]
          yield (convert_entid(ent1), convert_relid(rels1[0]),
                 convert_entid(ent2), convert_relid(rels2[0]),
                 convert_relid(rel3)), 0
        elif task == 'ci':
          assert len(query) == 2
          ent1, rels1 = query[0]
          ent2, rels2 = query[1]
          yield (convert_entid(ent1), convert_relid(rels1[0]),
                 convert_relid(rels1[1]),
                 convert_entid(ent2), convert_relid(rels2[0])), 0
        else:
          raise ValueError
Convert query2box features to EmQL features.

      We simply hard-code their input format for parsing, since there's not
      a simple way to automatically serialized to our input format.

      Yields:
        a tuple of features and label
      
language/emql/data_loader.py