Generating sentences using ACE

Hi,
I’m trying to generate phrases using ACE generation from a DMRSJson that i convert to MRS, but some sentences won’t generate. for exemple :

[{
“nodes”: [
{
“nodeid”: 10000,
“predicate”: “_the_q”
},
{
“nodeid”: 10001,
“predicate”: “_great_a_for”,
“sortinfo”: {
“SF”: “prop”,
“TENSE”: “untensed”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
}
},
{
“nodeid”: 10002,
“predicate”: “_dark_a_1”,
“sortinfo”: {
“SF”: “prop”,
“TENSE”: “untensed”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
}
},
{
“nodeid”: 10003,
“predicate”: “_spot_n_of”,
“sortinfo”: {
“PERS”: “3”,
“NUM”: “sg”,
“IND”: “+”,
“cvarsort”: “x”
}
},
{
“nodeid”: 10004,
“predicate”: “_think_v_1”,
“sortinfo”: {
“SF”: “prop”,
“TENSE”: “pres”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
}
},
{
“nodeid”: 10005,
“predicate”: “parg_d”,
“sortinfo”: {
“SF”: “prop”,
“TENSE”: “untensed”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
}
},
{
“nodeid”: 10006,
“predicate”: “_represent_v_1”,
“sortinfo”: {
“SF”: “prop-or-ques”,
“TENSE”: “untensed”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
}
},
{
“nodeid”: 10007,
“predicate”: “_a_q”
},
{
“nodeid”: 10008,
“predicate”: “_hole_n_1”,
“sortinfo”: {
“PERS”: “3”,
“NUM”: “sg”,
“IND”: “+”,
“cvarsort”: “x”
}
},
{
“nodeid”: 10009,
“predicate”: “_in_p”,
“sortinfo”: {
“SF”: “prop”,
“TENSE”: “untensed”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
}
},
{
“nodeid”: 10010,
“predicate”: “_the_q”
},
{
“nodeid”: 10011,
“predicate”: “named”,
“sortinfo”: {
“SF”: “prop”,
“TENSE”: “untensed”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
},
“carg”: “methane”
},
{
“nodeid”: 10012,
“predicate”: “compound”,
“sortinfo”: {
“SF”: “prop”,
“TENSE”: “untensed”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
}
},
{
“nodeid”: 10013,
“predicate”: “udef_q”
},
{
“nodeid”: 10014,
“predicate”: “_cloud_n_of”,
“sortinfo”: {
“IND”: “+”,
“cvarsort”: “x”
}
},
{
“nodeid”: 10015,
“predicate”: “_deck_n_1”,
“sortinfo”: {
“PERS”: “3”,
“NUM”: “sg”,
“IND”: “+”,
“cvarsort”: “x”
}
},
{
“nodeid”: 10016,
“predicate”: “of_p”,
“sortinfo”: {
“SF”: “prop”,
“TENSE”: “untensed”,
“MOOD”: “indicative”,
“PROG”: “-”,
“PERF”: “-”,
“cvarsort”: “e”
}
},
{
“nodeid”: 10017,
“predicate”: “proper_q”
},
{
“nodeid”: 10018,
“predicate”: “named”,
“sortinfo”: {
“PERS”: “3”,
“NUM”: “sg”,
“IND”: “+”,
“cvarsort”: “x”
},
“carg”: “Neptune”
}
],
“links”: [
{
“from”: 10000,
“to”: 10003,
“rargname”: “RSTR”,
“post”: “H”
},
{
“from”: 10001,
“to”: 10003,
“rargname”: “ARG1”,
“post”: “EQ”
},
{
“from”: 10002,
“to”: 10003,
“rargname”: “ARG1”,
“post”: “EQ”
},
{
“from”: 10004,
“to”: 10006,
“rargname”: “ARG2”,
“post”: “H”
},
{
“from”: 10005,
“to”: 10004,
“rargname”: “ARG1”,
“post”: “EQ”
},
{
“from”: 10005,
“to”: 10003,
“rargname”: “ARG2”,
“post”: “NEQ”
},
{
“from”: 10006,
“to”: 10003,
“rargname”: “ARG1”,
“post”: “NEQ”
},
{
“from”: 10006,
“to”: 10008,
“rargname”: “ARG2”,
“post”: “NEQ”
},
{
“from”: 10007,
“to”: 10008,
“rargname”: “RSTR”,
“post”: “H”
},
{
“from”: 10009,
“to”: 10006,
“rargname”: “ARG1”,
“post”: “EQ”
},
{
“from”: 10009,
“to”: 10015,
“rargname”: “ARG2”,
“post”: “NEQ”
},
{
“from”: 10010,
“to”: 10015,
“rargname”: “RSTR”,
“post”: “H”
},
{
“from”: 10011,
“to”: 10015,
“rargname”: “ARG1”,
“post”: “EQ”
},
{
“from”: 10012,
“to”: 10015,
“rargname”: “ARG1”,
“post”: “EQ”
},
{
“from”: 10012,
“to”: 10014,
“rargname”: “ARG2”,
“post”: “NEQ”
},
{
“from”: 10013,
“to”: 10014,
“rargname”: “RSTR”,
“post”: “H”
},
{
“from”: 10016,
“to”: 10015,
“rargname”: “ARG1”,
“post”: “EQ”
},
{
“from”: 10016,
“to”: 10018,
“rargname”: “ARG2”,
“post”: “NEQ”
},
{
“from”: 10017,
“to”: 10018,
“rargname”: “RSTR”,
“post”: “H”
}
]
}]

Here is my code :

    args = ['--max-chart-megabytes=6000', '--max-unpack-megabytes=6000' ,'--max-words=150' ,'--timeout=70']
    
    with delphin.ace.ACEGenerator('ace-0.9.34/erg-1214-x86-64-0.9.34.dat',args, executable='ace-0.9.34/ace') as generator:        
        mrs = delphin.commands.convert(input, "dmrsjson", "simplemrs", lnk=False)
        sentence =generator.interact(mrs).result(0)['surface']
        print(sentence)

There is no error i just get as an output :

NOTE: generated 0 / 1 sentences, avg 11438k, time 0.21830s
NOTE: transfer did 3333 successful unifies and 3073 failed ones

Thanks for your answers

Generation using ACE is not guaranteed to produce an output for any input. The (D)MRS must be compatible with the grammar. Could you explain where this DMRS has come from?

It looks like this DMRS might have come from the sentence “The Great Dark Spot is thought to represent a hole in the methane cloud deck of Neptune”. However, then I would expect two compound nodes, to link the nodes for “methane”, “cloud” and “deck”. Instead, there is an ARG1 link from node 10011 (named("methane")) to node 10015 (_deck_n_1). So I would not expect generation to be possible from this DMRS.

1 Like

Thanks for the answer,

*The DMRS is created from an mrs that is generated with ACE using the same 1214 grammar.

I managed to make it work for this sentence.
**While parsing it with ACE “Methane” should be capitalized.

I’m glad that you got it working.

I can’t reproduce the DMRS in the original post, however. If “methane” is not capitalised, then parsing with ACE and the 1214 ERG gives me the predicate _methane/jj_u_unknown, rather than named(methane). If “Methane” is capitalised, then I get named(Methane), but with a second compound relation.

Hello,

I’m still having some issues with ACE generation.Some sentences don’t get generated.
here is some examples in DMRSJson :

{
  "nodes": [
{
  "nodeid": 10000,
  "predicate": "appos",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 0,
    "to": 39
  }
},
{
  "nodeid": 10001,
  "predicate": "_the_q",
  "lnk": {
    "from": 0,
    "to": 3
  }
},
{
  "nodeid": 10002,
  "predicate": "named",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "IND": "+",
    "cvarsort": "x"
  },
  "carg": "Tarantula",
  "lnk": {
    "from": 4,
    "to": 14
  }
},
{
  "nodeid": 10003,
  "predicate": "_the_q",
  "lnk": {
    "from": 15,
    "to": 18
  }
},
{
  "nodeid": 10004,
  "predicate": "compound",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 19,
    "to": 39
  }
},
{
  "nodeid": 10005,
  "predicate": "proper_q",
  "lnk": {
    "from": 19,
    "to": 28
  }
},
{
  "nodeid": 10006,
  "predicate": "named",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "IND": "+",
    "PT": "notpro",
    "cvarsort": "x"
  },
  "carg": "Trickster",
  "lnk": {
    "from": 19,
    "to": 28
  }
},
{
  "nodeid": 10007,
  "predicate": "_character_n_1",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 29,
    "to": 39
  }
},
{
  "nodeid": 10008,
  "predicate": "_spin_v_1",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "past",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 40,
    "to": 44
  }
},
{
  "nodeid": 10009,
  "predicate": "_a_q",
  "lnk": {
    "from": 45,
    "to": 46
  }
},
{
  "nodeid": 10010,
  "predicate": "_black_a_1",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "bool",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 47,
    "to": 52
  }
},
{
  "nodeid": 10011,
  "predicate": "_cord_n_1",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "IND": "+",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 53,
    "to": 57
  }
},
{
  "nodeid": 10012,
  "predicate": "_and_c",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "past",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 58,
    "to": 62
  }
},
{
  "nodeid": 10013,
  "predicate": "udef_q",
  "lnk": {
    "from": 63,
    "to": 88
  }
},
{
  "nodeid": 10014,
  "predicate": "nominalization",
  "sortinfo": {
    "cvarsort": "x"
  },
  "lnk": {
    "from": 63,
    "to": 88
  }
},
{
  "nodeid": 10015,
  "predicate": "_attach_v_1",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "+",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 63,
    "to": 72
  }
},
{
  "nodeid": 10016,
  "predicate": "pron",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "GEND": "n",
    "PT": "std",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 73,
    "to": 75
  }
},
{
  "nodeid": 10017,
  "predicate": "pronoun_q",
  "lnk": {
    "from": 73,
    "to": 75
  }
},
{
  "nodeid": 10018,
  "predicate": "_to_p",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 76,
    "to": 78
  }
},
{
  "nodeid": 10019,
  "predicate": "_the_q",
  "lnk": {
    "from": 79,
    "to": 82
  }
},
{
  "nodeid": 10020,
  "predicate": "_ball_n_of",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "IND": "+",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 83,
    "to": 88
  }
},
{
  "nodeid": 10021,
  "predicate": "_crawl_v_dir",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "past",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 89,
    "to": 96
  }
},
{
  "nodeid": 10022,
  "predicate": "_away_p_state",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 97,
    "to": 101
  }
},
{
  "nodeid": 10023,
  "predicate": "_fast_a_1",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 102,
    "to": 106
  }
},
{
  "nodeid": 10024,
  "predicate": "_to_p_state",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 107,
    "to": 109
  }
},
{
  "nodeid": 10025,
  "predicate": "_the_q",
  "lnk": {
    "from": 110,
    "to": 113
  }
},
{
  "nodeid": 10026,
  "predicate": "_east_n_of",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "IND": "+",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 114,
    "to": 119
  }
},
{
  "nodeid": 10027,
  "predicate": "subord",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 120,
    "to": 162
  }
},
{
  "nodeid": 10028,
  "predicate": "_pull_v_on",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "+",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 120,
    "to": 127
  }
},
{
  "nodeid": 10029,
  "predicate": "_the_q",
  "lnk": {
    "from": 131,
    "to": 134
  }
},
{
  "nodeid": 10030,
  "predicate": "_cord_n_1",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 135,
    "to": 139
  }
},
{
  "nodeid": 10031,
  "predicate": "_with_p",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 140,
    "to": 144
  }
},
{
  "nodeid": 10032,
  "predicate": "part_of",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 145,
    "to": 148
  }
},
{
  "nodeid": 10033,
  "predicate": "_all_q",
  "lnk": {
    "from": 145,
    "to": 148
  }
},
{
  "nodeid": 10034,
  "predicate": "def_explicit_q",
  "lnk": {
    "from": 149,
    "to": 152
  }
},
{
  "nodeid": 10035,
  "predicate": "poss",
  "sortinfo": {
    "SF": "prop",
    "TENSE": "untensed",
    "MOOD": "indicative",
    "PROG": "-",
    "PERF": "-",
    "cvarsort": "e"
  },
  "lnk": {
    "from": 149,
    "to": 152
  }
},
{
  "nodeid": 10036,
  "predicate": "pronoun_q",
  "lnk": {
    "from": 149,
    "to": 152
  }
},
{
  "nodeid": 10037,
  "predicate": "pron",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "GEND": "m",
    "IND": "+",
    "PT": "std",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 149,
    "to": 152
  }
},
{
  "nodeid": 10038,
  "predicate": "_strength_n_1",
  "sortinfo": {
    "PERS": "3",
    "NUM": "sg",
    "cvarsort": "x"
  },
  "lnk": {
    "from": 153,
    "to": 162
  }
}
  ],
  "links": [
{
  "from": 10000,
  "to": 10002,
  "rargname": "ARG1",
  "post": "NEQ"
},
{
  "from": 10000,
  "to": 10007,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10001,
  "to": 10002,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10003,
  "to": 10007,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10004,
  "to": 10007,
  "rargname": "ARG1",
  "post": "EQ"
},
{
  "from": 10004,
  "to": 10006,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10005,
  "to": 10006,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10008,
  "to": 10002,
  "rargname": "ARG1",
  "post": "NEQ"
},
{
  "from": 10008,
  "to": 10011,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10009,
  "to": 10011,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10010,
  "to": 10011,
  "rargname": "ARG1",
  "post": "EQ"
},
{
  "from": 10012,
  "to": 10008,
  "rargname": "ARG1",
  "post": "EQ"
},
{
  "from": 10012,
  "to": 10021,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10013,
  "to": 10014,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10014,
  "to": 10015,
  "rargname": "ARG1",
  "post": "HEQ"
},
{
  "from": 10015,
  "to": 10016,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10015,
  "to": 10018,
  "rargname": "ARG3",
  "post": "H"
},
{
  "from": 10017,
  "to": 10016,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10018,
  "to": 10016,
  "rargname": "ARG1",
  "post": "NEQ"
},
{
  "from": 10018,
  "to": 10020,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10019,
  "to": 10020,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10021,
  "to": 10014,
  "rargname": "ARG1",
  "post": "NEQ"
},
{
  "from": 10022,
  "to": 10021,
  "rargname": "ARG1",
  "post": "EQ"
},
{
  "from": 10023,
  "to": 10021,
  "rargname": "ARG1",
  "post": "EQ"
},
{
  "from": 10024,
  "to": 10021,
  "rargname": "ARG1",
  "post": "EQ"
},
{
  "from": 10024,
  "to": 10026,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10025,
  "to": 10026,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10027,
  "to": 10021,
  "rargname": "ARG1",
  "post": "H"
},
{
  "from": 10027,
  "to": 10028,
  "rargname": "ARG2",
  "post": "H"
},
{
  "from": 10028,
  "to": 10030,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10029,
  "to": 10030,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10031,
  "to": 10028,
  "rargname": "ARG1",
  "post": "EQ"
},
{
  "from": 10031,
  "to": 10032,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10032,
  "to": 10038,
  "rargname": "ARG1",
  "post": "NEQ"
},
{
  "from": 10033,
  "to": 10032,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10034,
  "to": 10038,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10035,
  "to": 10038,
  "rargname": "ARG1",
  "post": "EQ"
},
{
  "from": 10035,
  "to": 10037,
  "rargname": "ARG2",
  "post": "NEQ"
},
{
  "from": 10036,
  "to": 10037,
  "rargname": "RSTR",
  "post": "H"
},
{
  "from": 10000,
  "to": 10008,
  "rargname": "MOD",
  "post": "EQ"
},
{
  "from": 10027,
  "to": 10008,
  "rargname": "MOD",
  "post": "EQ"
}
  ],
  "top": 10008,
  "index": 10012,
  "surface": "The Tarantula, the Trickster character, spun a black cord and, attaching it to the ball, crawled away fast to the east, pulling on the cord with all his strength."
}

    {
  "nodes": [
    {
      "nodeid": 10000,
      "predicate": "loc_nonsp",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 0,
        "to": 5
      }
    },
    {
      "nodeid": 10001,
      "predicate": "place_n",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "cvarsort": "x"
      },
      "lnk": {
        "from": 0,
        "to": 5
      }
    },
    {
      "nodeid": 10002,
      "predicate": "def_implicit_q",
      "lnk": {
        "from": 0,
        "to": 5
      }
    },
    {
      "nodeid": 10003,
      "predicate": "_there_a_1",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 0,
        "to": 5
      }
    },
    {
      "nodeid": 10004,
      "predicate": "pron",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "GEND": "m",
        "IND": "+",
        "PT": "std",
        "cvarsort": "x"
      },
      "lnk": {
        "from": 6,
        "to": 8
      }
    },
    {
      "nodeid": 10005,
      "predicate": "pronoun_q",
      "lnk": {
        "from": 6,
        "to": 8
      }
    },
    {
      "nodeid": 10006,
      "predicate": "_die_v_1",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "past",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 9,
        "to": 13
      }
    },
    {
      "nodeid": 10007,
      "predicate": "loc_nonsp",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 14,
        "to": 30
      }
    },
    {
      "nodeid": 10008,
      "predicate": "udef_q",
      "lnk": {
        "from": 14,
        "to": 30
      }
    },
    {
      "nodeid": 10009,
      "predicate": "card",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "carg": "6",
      "lnk": {
        "from": 14,
        "to": 17
      }
    },
    {
      "nodeid": 10010,
      "predicate": "_week_n_1",
      "sortinfo": {
        "PERS": "3",
        "NUM": "pl",
        "IND": "+",
        "cvarsort": "x"
      },
      "lnk": {
        "from": 18,
        "to": 23
      }
    },
    {
      "nodeid": 10011,
      "predicate": "loc_nonsp",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 24,
        "to": 30
      }
    },
    {
      "nodeid": 10012,
      "predicate": "time_n",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "cvarsort": "x"
      },
      "lnk": {
        "from": 24,
        "to": 30
      }
    },
    {
      "nodeid": 10013,
      "predicate": "def_explicit_q",
      "lnk": {
        "from": 24,
        "to": 30
      }
    },
    {
      "nodeid": 10014,
      "predicate": "_late_a_for",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 24,
        "to": 30
      }
    },
    {
      "nodeid": 10015,
      "predicate": "more_comp",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 24,
        "to": 30
      }
    },
    {
      "nodeid": 10016,
      "predicate": "_on_p_temp",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 31,
        "to": 33
      }
    },
    {
      "nodeid": 10017,
      "predicate": "udef_q",
      "lnk": {
        "from": 34,
        "to": 49
      }
    },
    {
      "nodeid": 10018,
      "predicate": "dofm",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "GEND": "n",
        "IND": "-",
        "cvarsort": "x"
      },
      "carg": "13",
      "lnk": {
        "from": 34,
        "to": 36
      }
    },
    {
      "nodeid": 10019,
      "predicate": "compound",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 34,
        "to": 36
      }
    },
    {
      "nodeid": 10020,
      "predicate": "proper_q",
      "lnk": {
        "from": 37,
        "to": 49
      }
    },
    {
      "nodeid": 10021,
      "predicate": "mofy",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "IND": "+",
        "cvarsort": "x"
      },
      "carg": "Jan",
      "lnk": {
        "from": 37,
        "to": 44
      }
    },
    {
      "nodeid": 10022,
      "predicate": "proper_q",
      "lnk": {
        "from": 45,
        "to": 49
      }
    },
    {
      "nodeid": 10023,
      "predicate": "yofc",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "IND": "+",
        "cvarsort": "x"
      },
      "carg": "888",
      "lnk": {
        "from": 45,
        "to": 49
      }
    }
  ],
  "links": [
    {
      "from": 10000,
      "to": 10006,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10000,
      "to": 10001,
      "rargname": "ARG2",
      "post": "NEQ"
    },
    {
      "from": 10002,
      "to": 10001,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10003,
      "to": 10001,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10005,
      "to": 10004,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10006,
      "to": 10004,
      "rargname": "ARG1",
      "post": "NEQ"
    },
    {
      "from": 10007,
      "to": 10006,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10007,
      "to": 10010,
      "rargname": "ARG2",
      "post": "NEQ"
    },
    {
      "from": 10008,
      "to": 10010,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10009,
      "to": 10010,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10011,
      "to": 10010,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10011,
      "to": 10012,
      "rargname": "ARG2",
      "post": "NEQ"
    },
    {
      "from": 10013,
      "to": 10012,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10014,
      "to": 10012,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10015,
      "to": 10014,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10016,
      "to": 10006,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10016,
      "to": 10018,
      "rargname": "ARG2",
      "post": "NEQ"
    },
    {
      "from": 10017,
      "to": 10018,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10019,
      "to": 10018,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10019,
      "to": 10021,
      "rargname": "ARG2",
      "post": "NEQ"
    },
    {
      "from": 10020,
      "to": 10021,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10021,
      "to": 10023,
      "rargname": "ARG1",
      "post": "NEQ"
    },
    {
      "from": 10022,
      "to": 10023,
      "rargname": "RSTR",
      "post": "H"
    }
  ],
  "top": 10006,
  "index": 10006,
  "surface": "There he died six weeks later, on 13 January 888."
}

{
  "nodes": [
    {
      "nodeid": 10000,
      "predicate": "pron",
      "sortinfo": {
        "PERS": "3",
        "NUM": "pl",
        "IND": "+",
        "PT": "std",
        "cvarsort": "x"
      },
      "lnk": {
        "from": 0,
        "to": 4
      }
    },
    {
      "nodeid": 10001,
      "predicate": "pronoun_q",
      "lnk": {
        "from": 0,
        "to": 4
      }
    },
    {
      "nodeid": 10002,
      "predicate": "_cultural_a_1",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 9,
        "to": 19
      }
    },
    {
      "nodeid": 10003,
      "predicate": "_akin_a_1",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "pres",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 20,
        "to": 24
      }
    },
    {
      "nodeid": 10004,
      "predicate": "_the_q",
      "lnk": {
        "from": 28,
        "to": 31
      }
    },
    {
      "nodeid": 10005,
      "predicate": "_coastal_a_1",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "bool",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 32,
        "to": 39
      }
    },
    {
      "nodeid": 10006,
      "predicate": "_people_n_of",
      "sortinfo": {
        "PERS": "3",
        "NUM": "pl",
        "IND": "+",
        "cvarsort": "x"
      },
      "lnk": {
        "from": 40,
        "to": 47
      }
    },
    {
      "nodeid": 10007,
      "predicate": "proper_q",
      "lnk": {
        "from": 51,
        "to": 68
      }
    },
    {
      "nodeid": 10008,
      "predicate": "compound",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 51,
        "to": 68
      }
    },
    {
      "nodeid": 10009,
      "predicate": "proper_q",
      "lnk": {
        "from": 51,
        "to": 60
      }
    },
    {
      "nodeid": 10010,
      "predicate": "compound",
      "sortinfo": {
        "SF": "prop",
        "TENSE": "untensed",
        "MOOD": "indicative",
        "PROG": "-",
        "PERF": "-",
        "cvarsort": "e"
      },
      "lnk": {
        "from": 51,
        "to": 60
      }
    },
    {
      "nodeid": 10011,
      "predicate": "proper_q",
      "lnk": {
        "from": 51,
        "to": 56
      }
    },
    {
      "nodeid": 10012,
      "predicate": "named",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "IND": "+",
        "PT": "notpro",
        "cvarsort": "x"
      },
      "carg": "Papua",
      "lnk": {
        "from": 51,
        "to": 56
      }
    },
    {
      "nodeid": 10013,
      "predicate": "named",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "IND": "+",
        "PT": "notpro",
        "cvarsort": "x"
      },
      "carg": "New",
      "lnk": {
        "from": 57,
        "to": 60
      }
    },
    {
      "nodeid": 10014,
      "predicate": "named",
      "sortinfo": {
        "PERS": "3",
        "NUM": "sg",
        "IND": "+",
        "cvarsort": "x"
      },
      "carg": "Guinea",
      "lnk": {
        "from": 61,
        "to": 68
      }
    }
  ],
  "links": [
    {
      "from": 10001,
      "to": 10000,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10002,
      "to": 10003,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10003,
      "to": 10000,
      "rargname": "ARG1",
      "post": "NEQ"
    },
    {
      "from": 10003,
      "to": 10006,
      "rargname": "ARG2",
      "post": "NEQ"
    },
    {
      "from": 10004,
      "to": 10006,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10005,
      "to": 10006,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10006,
      "to": 10014,
      "rargname": "ARG1",
      "post": "NEQ"
    },
    {
      "from": 10007,
      "to": 10014,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10008,
      "to": 10014,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10008,
      "to": 10013,
      "rargname": "ARG2",
      "post": "NEQ"
    },
    {
      "from": 10009,
      "to": 10013,
      "rargname": "RSTR",
      "post": "H"
    },
    {
      "from": 10010,
      "to": 10013,
      "rargname": "ARG1",
      "post": "EQ"
    },
    {
      "from": 10010,
      "to": 10012,
      "rargname": "ARG2",
      "post": "NEQ"
    },
    {
      "from": 10011,
      "to": 10012,
      "rargname": "RSTR",
      "post": "H"
    }
  ],
  "top": 10003,
  "index": 10003,
  "surface": "They are culturally akin to the coastal peoples of Papua New Guinea."
}

Thank you for your answers

If you would like futher help, I would appreciate if you could first respond to my previous post. I was unable to reproduce your DMRS, which suggests to me that you might be performing some additional processing.

Rather than just posting a list of large DMRSs, it would be helpful to explain what is going wrong, and to provide minimal working examples of the problem(s).

Hi,

I don’t really know what is going wrong, some sentences work and some don’t .

Here is how i get my DMRSs,

 #Create temporary MRS file
    echo $line | ./ace-0.9.34/ace -g ace-0.9.34/erg-2018-x86-64-0.9.34.dat -1f --max-chart-megabytes=15000 --max-unpack-megabytes=16000 --max-words=150 --timeout=150 > "RES/MRS/temp${n}.txt"

# modify the file for PyDelphin
head -n -2 "RES/MRS/temp${n}.txt" > "RES/MRS/temp2${n}.txt"
sed '2,${:a;N;$!ba;s/\n/ /g}' "RES/MRS/temp2${n}.txt" > "RES/MRS/sentence${n}.mrs"

Python code :

        lines   = f_mrs.readlines()
        if "SENT: " in lines[0]:
            sentence = lines[0].replace('SENT: ','')
            while '\"' in sentence:
                sentence = sentence.replace('\"', '"')

            if "[ MRS-FAILURE ]" not in lines[0]:

                #-----------------------------------------------------------
                # MRS data loading -----------------------------------------
                # ----------------------------------------------------------
                f_mrs.seek(0)
                mrs = ace.load(f_mrs)
                f_mrs.close()

                #-----------------------------------------------------------
                # MRS --> DMRS ---------------------------------------------
                # ----------------------------------------------------------
                dmrs = [dmrs.from_mrs(m) for m in mrs]

                # ----------------------------------------------------------
                # DMRS --> JSON --------------------------------------------
                #-----------------------------------------------------------
                json_data = [delphin.codecs.dmrsjson.encode(m) for m in dmrs]
                data = json.loads(json_data[0])

I don’t recommend doing so much manual processing to get the MRS object from ACE. That is, don’t use ACE’s -f option, and just output its stdout to a file and read that in to PyDelphin with the ace codec:

$ echo $line | ./ace-0.9.34/ace \
  -g ace-0.9.34/erg-2018-x86-64-0.9.34.dat \
  -1 \
  --max-chart-megabytes=15000 \
  --max-unpack-megabytes=16000 \
  --max-words=150 \
  --timeout=150 \
  > "RES/MRS/temp${n}.txt"

For the Python, it looks like you are reading the MRS, converting to DMRS, serializing to json, then deserializing the json to a dictionary? The last two steps, at least, can be simplified by using dmrsjson.to_dict()

from delphin.codecs import ace, dmrsjson
from delphin import dmrs
path = ...  # however you get your ACE output file path
for m in ace.load(path):  # ace.load() will open the file when given a path
  # check here for errors?
  d = dmrs.from_mrs(m)
  data = dmrsjson.to_dict(d)

If you’re processing one sentence at a time, it might be easier to just call ACE from within Python. See here.

But it seems like you’re doing some additional processing not evident in your example, as [ MRS-FAILURE ] is not an error message produced by ACE or PyDelphin. So I cannot recommend what to do about your error detection code.

1 Like

[ MRS-FAILURE ] is a code that comes from CSAW, actually. Are you getting some of your MRSes from CSAW instead of ACE? If so, that explains why they can’t be generated from.

2 Likes

I took your recommandations but i still have the same outpout.
as for [ MRS-FAILURE ] i was using CSAW before and i forgot to change that line.

If you are just parsing with ACE+ERG then generating with ACE+ERG, with no further processing, then I would expect very few problems.

However, there can be occasional bugs. What proportion of sentences are causing a problem?

Looking at the last example you’ve given – using this online demo for ERG v1214, “they are akin” can be parsed and generated, but “they are akin to us” can be parsed but not generated. This is in contrast to “they are analogous” and “they are analogous to us”, which can both be parsed and generated. The syntax and semantics is parallel between the sentences, so I think there is a bug for “akin”. This also illustrates what I mean by a minimal working example.

Some of these bugs get fixed over time. In the latest stable version of the ERG (2020), the lexical entry for “akin” is improved, and the sentence “They are akin to us.” parses and generates correctly. It would be good to know which of the sentences you’ve tried still fail to generate correctly using the 2020 version of the grammar.

3 Likes