<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <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="moz-cite-prefix">On 21/02/17 20:21, Michael Wayne
      Goodman wrote:<br>
    </div>
    <blockquote
cite="mid:CAP=XfC1-TiMFiAKGEhuAizCMEDRS8upNrf0zQ4LxYn6RqCR=Pw@mail.gmail.com"
      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-&gt;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_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_one(source)))</div>
        <div><br>
        </div>
        <div>DMRS-JSON -&gt; 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(source))</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">&lt;<a
              moz-do-not-send="true" href="mailto:goodmami@uw.edu"
              target="_blank">goodmami@uw.edu</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;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 -&gt; DMRS conversion in your script,
                it is essentially this:</div>
              <div><br>
              </div>
              <div>    print(dmrx.dumps(simplemrs.<wbr>load(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 -&gt; MRS conversion is the same, but
                reversed:</div>
              <div><br>
              </div>
              <div>    print(simplemrs.dumps(dmrx.<wbr>load(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 moz-do-not-send="true"
                  href="https://www.w3.org/TR/REC-xml/#NT-NameStartChar"
                  target="_blank">https://www.w3.org/TR/REC-<wbr>xml/#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-&gt;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="h5"><br>
                  <div class="gmail_quote">On Tue, Feb 21, 2017 at 1:13
                    AM, megha jain <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="mailto:jain11megha@gmail.com"
                        target="_blank">jain11megha@gmail.com</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;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
                                =&gt; MRS<br>
                              </div>
                                                            <wbr>   MRS
                              =&gt; DMRS<br>
                            </div>
                                                          <wbr>   DMRS
                            =&gt; 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="HOEnZb"><font color="#888888">-- <br>
                  <div class="m_-4721760205035595285gmail_signature"
                    data-smartmail="gmail_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_signature" data-smartmail="gmail_signature">
          <div dir="ltr">Michael Wayne Goodman
            <div>Ph.D. Candidate, UW Linguistics</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>