<div dir="ltr"><div dir="auto">Thanks, Ann. Francis said (offline) something similar about those being grammar-internal properties. I've updated the RmrsVpm wiki with an example of how to remove them via a VPM (<a href="http://moin.delph-in.net/RmrsVpm#Corner_Cases">http://moin.delph-in.net/RmrsVpm#Corner_Cases</a>). Is there any better place to document this information?</div><div dir="auto"><br></div><div>And I also thought it might affect MRS's XML format as well, but then I remembered that property names are stored as element text instead of attribute names, so they don't suffer the same problem:</div><div><br></div><div>...</div><div><extrapair><path>--PSV</path><value>non-apsv</value></extrapair><br></div><div>...</div><div><br></div><div>It would affect the RMRX format, though.</div><div class="gmail_extra"><br><div class="gmail_quote">On Feb 22, 2017 04:42, "Ann Copestake" <<a href="mailto:aac10@cl.cam.ac.uk" target="_blank">aac10@cl.cam.ac.uk</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>from memory, the interpretation of the "--" was intended to be
that this was something that should not appear in the external MRS</p>
<p>in any case, it wouldn't be a DMRS issue, as such, since
presumably it could apply to any of the MRS XML formats</p>
<p>All best,</p>
<p>Ann<br>
</p>
<br>
<div class="gmail-m_-6197449233122389341m_-1723262010466248444moz-cite-prefix">On 21/02/17 20:21, Michael Wayne
Goodman wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Ann:</div>
<div> Does the LKB do anything special regarding properties like
--PSV when reading/writing DMRX? They aren't ill-formed in the
SimpleMRS format, so I'm wondering if PyDelphin should attempt
to do anything special for these.</div>
<div><br>
</div>
<div>Megha:</div>
<div> I just thought of another alternative. You can serialize
to the DMRS-JSON format instead of DMRX. JSON doesn't have the
same attribute name constraints as XML. The process is
slightly different. Here is MRS->DMRS-JSON conversion:</div>
<div><br>
</div>
<div> import json</div>
<div> from delphin.mrs import simplemrs</div>
<div> from delphin.mrs.xmrs import Dmrs</div>
<div>
<div> print(</div>
<div> json.dumps(</div>
<div>
Dmrs.from_xmrs(simplemrs.load_<wbr>one(source)).to_dict()</div>
<div> )</div>
<div> )</div>
</div>
<div><br>
</div>
<div>(the Dmrs.from_xmrs(...) bit is just for Python2
compatibility. In Python3, you can just do:
Dmrs.to_dict(simplemrs.loads_o<wbr>ne(source)))</div>
<div><br>
</div>
<div>DMRS-JSON -> MRS conversion is similar:</div>
<div><br>
</div>
<div> ...</div>
<div>
<div> print(</div>
<div> simplemrs.dumps_one(</div>
<div> Dmrs.from_dict(json.load(sourc<wbr>e))</div>
<div> )</div>
<div> ) </div>
</div>
<div><br>
</div>
<div>These methods require PyDelphin v0.6.0 (the latest
release).</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Feb 21, 2017 at 11:35 AM,
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 Megha,
<div><br>
</div>
<div>(I've re-CC'd the developers list so they can benefit
or contribute; please include them in follow-up replies)<br>
<div><br>
</div>
<div>Thanks for clarifying.</div>
</div>
<div><br>
</div>
<div>When you do MRS -> DMRS conversion in your script,
it is essentially this:</div>
<div><br>
</div>
<div> print(dmrx.dumps(simplemrs.loa<wbr>d(source)))</div>
<div><br>
</div>
<div>This loads the simplemrs-encoded source (e.g. a file
or sys.stdin; or use simplemrs.loads() for a string
argument) into the internal *MRS representation, then
the dmrx codec serializes the internal representation to
DMRX. Doing DMRS -> MRS conversion is the same, but
reversed:</div>
<div><br>
</div>
<div> print(simplemrs.dumps(dmrx.loa<wbr>d(source)))</div>
<div><br>
</div>
<div>(More technically, the dmrx and simplemrs codecs
decode the text streams/strings and instantiate the
Dmrs() and Mrs() classes, respectively, in the
delphin.mrs.xmrs module. It is these classes (and not
the codecs themselves) that do the actual conversion
into the internal format.)</div>
<div><br>
</div>
<div>However, there is a problem with the GG grammar and
DMRS. The variable properties prefixed by "--" (e.g.
"--PSV") cause errors when loading a DMRS. This is
because the hyphen is not a valid initial character in
an XML attribute name (<a href="https://www.w3.org/TR/REC-xml/#NT-NameStartChar" target="_blank">https://www.w3.org/TR/REC-xml<wbr>/#NT-NameStartChar</a>).
It is Python's XML parser, and not PyDelphin, that is
failing to load the DMRX instance. I suggest doing one
of the following:</div>
<div><br>
</div>
<div> 1. Change the attribute names in the GG grammar</div>
<div><br>
</div>
<div> 2. In your conversion script, find and replace these
attributes on the MRS before converting to DMRS, and
change them back in DMRS->MRS conversion. You may use
underscores (e.g. "__PSV") as the initial character,
according to the XML spec.</div>
<div><br>
</div>
<div>Does this help?</div>
</div>
<div class="gmail_extra">
<div>
<div class="gmail-m_-6197449233122389341m_-1723262010466248444h5"><br>
<div class="gmail_quote">On Tue, Feb 21, 2017 at 1:13
AM, megha jain <span dir="ltr"><<a href="mailto:jain11megha@gmail.com" target="_blank">jain11megha@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>
<div>
<div>
<div>
<div>
<div>
<div>Hello Michael.<br>
<br>
</div>
I know usage of Pydelphin so able
to implement via this.<br>
<br>
</div>
I want to know which python code is
being used by you to convert German
DMRS into German MRS again?<br>
<br>
</div>
So that this MRS can be given ACE to
generate corresponding German
sentence.<br>
<br>
</div>
I am able to process : German sentence
=> MRS<br>
</div>
<wbr> MRS
=> DMRS<br>
</div>
<wbr> DMRS
=> MRS (that is my concern)<br>
<br>
</div>
<div>EXAMPLE :-(A.) INPUT : Abrams bellte
sehr leise.</div>
<div><br>
(B.) When I gave above one sentence to ACE ,
It generated following MRS :-<br>
(command used : ./ace -g ggp.dat -1Tf
input_file.txt)<br>
<br>
</div>
<div>Following file is attached below.<br>
</div>
<div><br>
</div>
<div>(C) I gave this MRS as an input to
mrs_to_dmrs-pp.py pyhon code and
corresponding DMRS generated.<br>
</div>
<div>Following file is attached below.<br>
<br>
</div>
<div>(D.) After this I want to convert
corresponding DMRS into MRS . Which python
code comes in use for this approach?<br>
</div>
<div><br>
<br>
</div>
Hopefully I am able to make you understand
what is my concern.<br>
<br>
</div>
Thank You.<br>
<div>
<div>
<div>
<div>
<div>
<div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
</div>
</div>
<span class="gmail-m_-6197449233122389341m_-1723262010466248444HOEnZb"><font color="#888888">-- <br>
<div class="gmail-m_-6197449233122389341m_-1723262010466248444m_-4721760205035595285gmail_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">
<div><br>
</div>
-- <br>
<div class="gmail-m_-6197449233122389341m_-1723262010466248444gmail_signature">
<div dir="ltr">Michael Wayne Goodman
<div>Ph.D. Candidate, UW Linguistics</div>
</div>
</div>
</div>
</blockquote>
<br>
</div>
</blockquote></div></div>
</div>