<div dir="ltr"><div>I found the problem. It was not the transformations, but the manual string editing that stole my CARGs. When I edit DMRS manually, I convert DMRSes to strings first, and then convert them back to DMRS objects later. This is what I meant by "strings"<br><pre><code id="gmail-dmrs1_json" class="gmail-hljs elixir">dmrs {
<span class="gmail-hljs-number">10000</span> [def_explicit_q<<span class="gmail-hljs-number">0</span><span class="gmail-hljs-symbol">:</span><span class="gmail-hljs-number">2</span>> x pers=<span class="gmail-hljs-number">3</span> num=sg ind=+];
<span class="gmail-hljs-number">10001</span> [poss<<span class="gmail-hljs-number">0</span><span class="gmail-hljs-symbol">:</span><span class="gmail-hljs-number">2</span>> e tense=untensed prog=- perf=- mood=indicative sf=prop];
<span class="gmail-hljs-number">10002</span> [pronoun_q<<span class="gmail-hljs-number">0</span><span class="gmail-hljs-symbol">:</span><span class="gmail-hljs-number">2</span>> x pers=<span class="gmail-hljs-number">1</span> num=sg pt=std];
<span class="gmail-hljs-number">10003</span> [pron<<span class="gmail-hljs-number">0</span><span class="gmail-hljs-symbol">:</span><span class="gmail-hljs-number">2</span>> x pers=<span class="gmail-hljs-number">1</span> num=sg pt=std];
<span class="gmail-hljs-number">10004</span> [_name_n_of_rel<<span class="gmail-hljs-number">3</span><span class="gmail-hljs-symbol">:</span><span class="gmail-hljs-number">7</span>> x pers=<span class="gmail-hljs-number">3</span> num=sg ind=+];
<span class="gmail-hljs-number">10005</span> [_be_v_id_rel<<span class="gmail-hljs-number">8</span><span class="gmail-hljs-symbol">:</span><span class="gmail-hljs-number">10</span>> e tense=pres prog=- perf=- mood=indicative sf=prop];
<span class="gmail-hljs-number">10006</span> [udef_q<<span class="gmail-hljs-number">11</span><span class="gmail-hljs-symbol">:</span><span class="gmail-hljs-number">20</span>> x pers=<span class="gmail-hljs-number">3</span> num=pl ind=+];
<span class="gmail-hljs-number">10007</span> [named<<span class="gmail-hljs-number">11</span><span class="gmail-hljs-symbol">:</span><span class="gmail-hljs-number">20</span>><span style="color:rgb(0,0,255)">(<span class="gmail-hljs-string">"Abraham"</span>)</span> x pers=<span class="gmail-hljs-number">3</span> num=pl ind=+];
<span class="gmail-hljs-number">0</span><span class="gmail-hljs-symbol">:/H</span> -> <span class="gmail-hljs-number">10005</span>;
<span class="gmail-hljs-number">10000</span><span class="gmail-hljs-symbol">:RSTR/H</span> -> <span class="gmail-hljs-number">10004</span>;
<span class="gmail-hljs-number">10001</span><span class="gmail-hljs-symbol">:ARG2/NEQ</span> -> <span class="gmail-hljs-number">10003</span>;
<span class="gmail-hljs-number">10001</span><span class="gmail-hljs-symbol">:ARG1/EQ</span> -> <span class="gmail-hljs-number">10004</span>;
<span class="gmail-hljs-number">10002</span><span class="gmail-hljs-symbol">:RSTR/H</span> -> <span class="gmail-hljs-number">10003</span>;
<span class="gmail-hljs-number">10005</span><span class="gmail-hljs-symbol">:ARG1/NEQ</span> -> <span class="gmail-hljs-number">10004</span>;
<span class="gmail-hljs-number">10005</span><span class="gmail-hljs-symbol">:ARG2/NEQ</span> -> <span class="gmail-hljs-number">10007</span>;
<span class="gmail-hljs-number">10006</span><span class="gmail-hljs-symbol">:RSTR/H</span> -> <span class="gmail-hljs-number">10007</span>;
}</code></pre></div>When I convert them back, I forgot that CARGs in the brackets after cfrom:cto, and not in the attribute list (<code id="gmail-dmrs1_json" class="gmail-hljs elixir">pers=<span class="gmail-hljs-number">3</span> num=pl ind=+</code>). <br></div><div class="gmail_extra"><br><div class="gmail_quote">On 28 July 2017 at 02:10, Michael Wayne Goodman <span dir="ltr"><<a href="mailto:goodmami@uw.edu" target="_blank">goodmami@uw.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Forgive me, Tuan Anh, for bringing the discussion back to the list...<br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Jul 27, 2017 at 9:25 AM, Tuấn Anh Lê <span dir="ltr"><<a href="mailto:tuananh.ke@gmail.com" target="_blank">tuananh.ke@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Mike, thank so much. I'm still debugging to see why the CARGS disappeared. I'm supporting different formats now and in the middle of converting back and forth something weird happened. I suspect it's my code that caused the problem. My parsing flow right now is pyDelphin/ACE => XMRS => XML/JSON/string (for manual editing).<br><br></div>If I did lose the CARGS, is it possible to add them back in automatically given that I have this MRS and the sentence text or I have to write code to do that?<br></div></blockquote><div><br></div></span><div>Unless I see your transformations I can't really pinpoint where CARGS is being lost. So instead I'll confirm that PyDelphin doesn't drop them during the conversions you mentioned:</div><div><br></div><div><div> >>> from delphin.interfaces import ace</div><div> >>> from delphin.mrs import xmrs, dmrx</div><div> >>> r = ace.parse(</div><div> ... '/home/goodmami/grammars/erg-1<wbr>214/erg-1214.dat',</div><div> ... 'My name is Sherlock Holmes.')</div><div> NOTE: parsed 1 / 1 sentences, avg 3668k, time 0.12449s</div><div> >>> x = r.result(0).mrs() # ACE => XMRS</div><div> >>> j = xmrs.Dmrs.to_dict(x) # XMRS => JSON</div><div> >>> x2 = xmrs.Dmrs.from_dict(j) # JSON => XMRS</div><div> >>> x2.ep(10009).carg</div><div> 'Sherlock'</div><div> >>> d = dmrx.dumps_one(x) # XMRS => XML</div><div> >>> x3 = dmrx.loads_one(d) # XML => XMRS</div><div> >>> x3.ep('10009').carg # nodeid became string from conversion</div><div> 'Sherlock'</div></div><div> </div><div>I'm not sure what you meant by converting to "string". But I think it's your transformations that are causing the lost CARGs. Are you able to say what those transformations do?</div><div><div class="h5"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span id="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680gmail-sentence_text"><span class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680gmail-sentence_text_normal">"My name is Sherlock Holmes.</span></span><pre><code id="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680gmail-xmlcontent" class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680gmail-hljs m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680gmail-xml">[ TOP: h0
RELS: < [ def_explicit_q_rel<0:3> LBL: h1 ARG0: x12 [ x NUM: sg IND: + PERS: 3 ] RSTR: h17 ]
[ poss_rel<0:3> LBL: h2 ARG0: e10 [ e TENSE: untensed MOOD: indicative PERF: - SF: prop PROG: - ] ARG1: x12 ARG2: x11 [ x NUM: sg PERS: 1 ] ]
[ pronoun_q_rel<0:3> LBL: h3 ARG0: x11 RSTR: h18 ]
[ pron_rel<0:3> LBL: h4 ARG0: x11 ]
[ _name_n_of_rel<4:8> LBL: h2 ARG0: x12 ]
[ _be_v_id_rel<9:11> LBL: h5 ARG0: e13 [ e TENSE: pres MOOD: indicative PERF: - SF: prop PROG: - ] ARG1: x12 ARG2: x16 [ x NUM: sg IND: + PERS: 3 ] ]
[ proper_q_rel<12:28> LBL: h6 ARG0: x16 RSTR: h19 ]
[ compound_rel<12:28> LBL: h7 ARG0: e14 [ e TENSE: untensed MOOD: indicative PERF: - SF: prop PROG: - ] ARG1: x16 ARG2: x15 [ x NUM: sg IND: + PERS: 3 ] ]
[ proper_q_rel<12:20> LBL: h8 ARG0: x15 RSTR: h20 ]
<span style="color:rgb(0,0,255)"> [ named_rel<12:20> LBL: h9 ARG0: x15 ]
[ named_rel<21:28> LBL: h7 ARG0: x16 ] ></span>
HCONS: < h0 qeq h5 h17 qeq h2 h18 qeq h4 h19 qeq h7 h20 qeq h9 > ]</code></pre></div><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-HOEnZb"><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On 27 July 2017 at 12:39, Michael Wayne Goodman <span dir="ltr"><<a href="mailto:goodmami@uw.edu" target="_blank">goodmami@uw.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Wed, Jul 26, 2017 at 6:42 PM, Tuấn Anh Lê <span dir="ltr"><<a href="mailto:tuananh.ke@gmail.com" target="_blank">tuananh.ke@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Mike,<br><br></div>Thanks for answering :D. I think I misunderstood STRINGPRED flag in pyDelphin. I always think that there are 2 types of predicates, namely GRAMMARPRED and REALPRED. However I have encountered two different types of GRAMMARPRED, the one without cargs (such as pronoun_q_rel) and the one with carg (such as named_rel). I thought STRINGPRED was used to represent the GRAMMARPRED with CARG. <br></div></blockquote><div><br></div></span><div>Ah I see. Unfortunately there is no predicate subcategorization that indicates the presence of a constant argument. But, fortunately, there is only one argument role for constant arguments (CARG), and nobody that I'm aware of has chosen to rename it or add additional ones. The LKB and PET allowed it to be customized via a *value-feats* parameter, but ACE just assumes it will be "CARG", and nobody's complained about that yet. So I think it's safe to assume it will be called "CARG". This assumption makes the following easier...</div><span><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Right now I'm transforming DMRS using pyDelphin and I'm looking for a way to find GRAMMARPRED with CARG because after each transformation pyDelphin take my CARGS out and hide them some where. I need the CARGS for other mapping though. Is there a way to accomplish this?<br></div></blockquote><div><br></div></span><div>When working with Xmrs structures in PyDelphin, just look for "CARG" on an EP's arguments. E.g. for some Xmrs object x that represents the sentence "Abrams slept." where the named_rel EP has nodeid 10001:</div><div><br></div><div><div>>>> x.ep(10001).args.get('CARG')<br></div><div>'Abrams'</div></div><div><br></div><div>For convenience, I also define a "carg" property on EPs:</div><div><br></div><div><div>>>> x.ep(10001).carg</div><div>'Abrams'</div></div><div><br></div><div>These are essentially equivalent. If you just want to test for the presence of the CARG, you can do this:</div><div><br></div><div><div>>>> 'CARG' in x.ep(10001).args</div><div>True</div><div>>>> 'CARG' in x.ep(10000).args # 10000 is for proper_q</div><div>False</div></div><div><br></div><div>In DMRS, nodes do not contain information about the arguments the node participates in; this information is stored in the links. However, CARGs are special in that they become node attributes instead of links:</div><div><br></div><div><div>>>> from delphin.mrs.components import nodes</div><div>>>> ns = {n.nodeid: n for n in nodes(x)}</div><div>>>> ns[10001].carg<br></div><div>'Abrams'</div></div><div><br></div><div>If you try to recreate an Xmrs from Dmrs nodes and don't give it any links, you will only get intrinsic arguments (ARG0s) and CARGs, and any other arguments will be lost:</div><div><br></div><div><div>>>> from delphin.mrs.xmrs import Dmrs</div><div>>>> d = Dmrs(nodes=ns.values())<br></div><div>>>> d.ep(10001).args<br></div><div>{'CARG': 'Abrams', 'ARG0': 'x5'}</div><div>>>> d.ep(10002).args # 10002 is for "slept"</div><div>{'ARG0': 'e6'}</div></div><div><br></div><div>If you also give it the links, it should be able to recreate the original (x)mrs.</div><div><br></div><div>So I'm not sure what kind of transformation you are doing would cause the CARG to be lost. Can you elaborate or provide a MWE (minimal working example) that shows when the CARG is lost/hidden?</div><div><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680h5"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail-h5"><br><div class="gmail_quote">On 27 July 2017 at 03:45, Michael Wayne Goodman <span dir="ltr"><<a href="mailto:goodmami@uw.edu" target="_blank">goodmami@uw.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Tuan Anh,<div><br></div><div>The thinking of subtypes of predicates has changed over the years, and as a result there's numerous overlapping terms for various things. I believe that the current consensus (documented on <a href="http://moin.delph-in.net/PredicateRfc" target="_blank">http://moin.delph-in.net/Pr<wbr>edicateRfc</a>) is that there are two main axes of subcategorization for predicate symbols: abstract vs surface and string vs type (with "real" predicates being a decomposed form of surface preds). But I suspect what you mean by STRINGPRED is not the same thing as described on the wiki?<br></div><div><br></div><div>I'm afraid PyDelphin is a bit behind the times WRT these definitions of predicates, and instead follows mostly what was described in the MRS DTD (as I understood it at the time). Therefore currently PyDelphin calls predicates beginning with an underscore a "stringpred", regardless of whether the symbol was quoted or not. I.e., it should be called "surfacepred" or something. Abstract predicates are called "grammarpred" in PyDelphin. I have created a ticket for this bug: <a href="https://github.com/delph-in/pydelphin/issues/117" target="_blank">https://github.com/delph-<wbr>in/pydelphin/issues/117</a>.</div><div><br></div><div>Now back to your question, "named_rel" is called a GRAMMARPRED in PyDelphin because the predicate does not start with an underscore.</div></div><div class="gmail_extra"><div><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail-m_5258065618808295139m_-2284633896360486370h5"><br><div class="gmail_quote">On Wed, Jul 26, 2017 at 8:25 AM, Tuấn Anh Lê <span dir="ltr"><<a href="mailto:tuananh.ke@gmail.com" target="_blank">tuananh.ke@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Hi delphinians,<br><br></div>I'm working on predicate mapping and found that named_rel are not STRINGPRED when processed by pyDelphin.Are these expected behaviours? Can someone please shed some light for me on this matter :D Thank you.<br clear="all"></div><div><div><div><div><br><span style="color:rgb(0,0,0)"><span style="font-family:monospace,monospace">REALPRED 1<br>STRINGPRED 2<br><ElementaryPredication object (pron_rel (x24)) at 140241381023560> 0<br><ElementaryPredication object (pronoun_q_rel (x24)) at 140241380610120> 0<br><ElementaryPredication object (_have_v_1_rel (e25)) at 140241380610240> 1<br><ElementaryPredication object (_the_q_rel (x26)) at 140241380610360> 1<br><ElementaryPredication object (_pleasure_n_of_rel (x26)) at 140241380610480> 1<br><ElementaryPredication object (udef_q_rel (x27)) at 140241380610600> 0<br><ElementaryPredication object (nominalization_rel (x27)) at 140241380610720> 0<br><ElementaryPredication object (_make_v_1_rel (e28)) at 140241380610840> 1<br><ElementaryPredication object (_the_q_rel (x29)) at 140241380610960> 1<br><ElementaryPredication object (_doctor_n_1_rel (x29)) at 140241380611080> 1<br><ElementaryPredication object (def_explicit_q_rel (x31)) at 140241380611200> 0<br><ElementaryPredication object (poss_rel (e30)) at 140241380611320> 0<br><ElementaryPredication object (_acquaintance_n_1_rel (x31)) at 140241380611440> 1<br><ElementaryPredication object (_say_v_to_rel (e32)) at 140241380611560> 1<br><ElementaryPredication object (proper_q_rel (x33)) at 140241380611680> 0<br><span style="color:rgb(0,0,255)"><b><ElementaryPredication object (named_rel (x33)) at 140241380611800> 0</b></span><br><ElementaryPredication object (_and_c_rel (e34)) at 140241380611920> 1<br><ElementaryPredication object (_in_p_rel (e35)) at 140241380612040> 1<br><ElementaryPredication object (udef_q_rel (x37)) at 140241380612160> 0<br><ElementaryPredication object (_a+few_a_1_rel (e36)) at 140241380612280> 1<br><ElementaryPredication object (_word_n_of_rel (x37)) at 140241380612400> 1<br><ElementaryPredication object (pron_rel (x38)) at 140241380612520> 0<br><ElementaryPredication object (pronoun_q_rel (x38)) at 140241380612640> 0<br><ElementaryPredication object (_sketch_v_1_rel (e39)) at 140241380612760> 1<br><ElementaryPredication object (_out_p_rel (e40)) at 140241380612880> 1<br><ElementaryPredication object (free_relative_q_rel (x41)) at 140241380613000> 0<br><ElementaryPredication object (thing_rel (x41)) at 140241380613120> 0<br><ElementaryPredication object (_occur_v_to_rel (e42)) at 140241380613240> 1</span></span><br><br><br><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail-m_5258065618808295139m_-2284633896360486370m_1562247147066762726m_-8402390868988665582gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-size:small">Yours,</span><span class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail-m_5258065618808295139m_-2284633896360486370m_1562247147066762726HOEnZb"><font color="#888888"><br style="font-size:small"><span style="font-size:small">-- </span><br style="font-size:small"><div style="font-size:small"><div dir="ltr">Tuan Anh Le</div></div></font></span></div></div></div></div>
</div></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail-m_5258065618808295139m_-2284633896360486370HOEnZb"><font color="#888888">-- <br><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail-m_5258065618808295139m_-2284633896360486370m_1562247147066762726gmail_signature"><div dir="ltr">Michael Wayne Goodman<div>Ph.D. Candidate, UW Linguistics</div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><br></div></div>-- <br><span class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail-"><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail-m_5258065618808295139m_-2284633896360486370gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-size:small">Yours,</span><br style="font-size:small"><span style="font-size:small">-- </span><br style="font-size:small"><div style="font-size:small"><div dir="ltr">Tuan Anh Le</div></div></div></div></div></div>
</span></div></div>
</blockquote></div></div></div><div><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680h5"><br><br clear="all"><div><br></div>-- <br><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680m_-1383643256138277059gmail_signature"><div dir="ltr">Michael Wayne Goodman<div>Ph.D. Candidate, UW Linguistics</div></div></div>
</div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail-m_-6160245009372258680gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-size:small">Yours,</span><br style="font-size:small"><span style="font-size:small">-- </span><br style="font-size:small"><div style="font-size:small"><div dir="ltr">Tuan Anh Le</div></div></div></div></div></div>
</div>
</div></div></blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><div class="m_8973244911321853187m_-5426726898437272458gmail-m_485623995376237572gmail_signature"><div dir="ltr">Michael Wayne Goodman<div>Ph.D. Candidate, UW Linguistics</div></div></div>
</div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span style="font-size:small">Yours,</span><br style="font-size:small"><span style="font-size:small">-- </span><br style="font-size:small"><div style="font-size:small"><div dir="ltr">Tuan Anh Le</div></div></div></div></div></div>
</div>