Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples of MRS/ERS in PENMAN format? #130

Closed
nschneid opened this issue Jan 8, 2018 · 7 comments
Closed

Examples of MRS/ERS in PENMAN format? #130

nschneid opened this issue Jan 8, 2018 · 7 comments
Labels

Comments

@nschneid
Copy link

nschneid commented Jan 8, 2018

I gather from https://github.com/delph-in/pydelphin/wiki/delphin.mrs.penman that MRS structures can be displayed in PENMAN notation. For those of us who are familiar with that notation, can some examples be shown in that notation, e.g. the ones from http://moin.delph-in.net/ErgSemantics/Essence?

@goodmami
Copy link
Member

goodmami commented Jan 8, 2018

Yes, i'll try to give some examples below. Note: I haven't worked out a PENMAN representation of MRS, as its ability for an argument to select a node or a scope (which is a set of nodes, thus requiring hyperedges) is difficult to represent as a simple DAG, but I do have a working representation for two dependency-based representations of MRS (EDS and DMRS), which avoid being hypergraphs by select a "representative node" out of a scope.

EDS

I parse a sentence, e.g., "Kim gave Sandy the book", with ACE and the 1214 version of the ERG then convert using PyDelphin as follows:

goodmami@tpy:~/repos/pydelphin$ ace -g ~/grammars/erg-1214-x86-64-0.9.25.dat <<< "Kim gave Sandy the book." -Tq1 | ./delphin.sh convert --to eds-penman --no-properties

The result is:

(e2 / _give_v_1
    :lnk "<4:8>"
    :ARG1 (x3 / named
              :lnk "<0:3>"
              :carg "Kim"
              :BV-of (_1 / proper_q
                         :lnk "<0:3>"))
    :ARG2 (x9 / _book_n_of
              :lnk "<19:24>"
              :BV-of (_3 / _the_q
                         :lnk "<15:18>"))
    :ARG3 (x10 / named
               :lnk "<9:14>"
               :carg "Sandy"
               :BV-of (_2 / proper_q
                          :lnk "<9:14>")))

I turned off properties, like :NUM sg, etc., to keep the graphs tidy. The :lnk "<4:8>" relations are character alignments. Let me know if you want any explanation of how our use of variables, predicates (concepts), or relations differs from AMR.

Note: the PyDelphin conversion to EDS does not use all EDS features, but the results should still be valid. Also see http://moin.delph-in.net/EdsTop#Alternative_Serializations for Stephan Oepen's version; his (using the LKB instead of ACE, and with support for all EDS features) is available via the web-API, e.g.:

http://erg.delph-in.net/rest/0.9/parse?input="Kim gave Sandy the book."&eds=amr

(sorry, no frontend for it right now).

Here's a few more examples from PyDelphin:

; "The cheerful children wanted to sing and dance."
(e2 / _want_v_1
    :lnk "<22:28>"
    :ARG1 (x3 / _child_n_1
              :lnk "<13:21>"
              :BV-of (_1 / _the_q
                         :lnk "<0:3>")
              :ARG1-of (e8 / _cheerful_a_1
                           :lnk "<4:12>"))
    :ARG2 (e14 / _and_c
               :lnk "<37:40>"
               :L-INDEX (e11 / _sing_v_1
                             :lnk "<32:36>"
                             :ARG1 x3)
               :R-INDEX (e15 / _dance_v_1
                             :lnk "<41:47>"
                             :ARG1 x3)
               :L-HNDL e11
               :R-HNDL e15))

; "This technique is impossible to apply."
(e2 / _impossible_a_for
    :lnk "<18:28>"
    :ARG1 (e11 / _apply_v_2
               :lnk "<32:38>"
               :ARG2 (x3 / _technique_n_1
                         :lnk "<5:14>"
                         :BV-of (_1 / _this_q_dem
                                    :lnk "<0:4>"))))

; "All dogs chased a cat."
(e2 / _chase_v_1
    :lnk "<9:15>"
    :ARG1 (x3 / _dog_n_1
              :lnk "<4:8>"
              :BV-of (_1 / _all_q
                         :lnk "<0:3>"))
    :ARG2 (x8 / _cat_n_1
              :lnk "<18:22>"
              :BV-of (_2 / _a_q
                         :lnk "<16:17>")))

DMRS

DMRS is very similar to EDS but retains scope information through secondary edge labels. Here are the same examples (just change the --to option of delphin.sh to use dmrs-penman).

; "Kim gave Sandy the book."
(10002 / _give_v_1
       :lnk "<4:8>"
       :ARG1-NEQ (10001 / named
                        :lnk "<0:3>"
                        :carg "Kim"
                        :RSTR-H-of (10000 / proper_q
                                          :lnk "<0:3>"))
       :ARG3-NEQ (10004 / named
                        :lnk "<9:14>"
                        :carg "Sandy"
                        :RSTR-H-of (10003 / proper_q
                                          :lnk "<9:14>"))
       :ARG2-NEQ (10006 / _book_n_of
                        :lnk "<19:24>"
                        :RSTR-H-of (10005 / _the_q
                                          :lnk "<15:18>")))

; "The cheerful children wanted to sing and dance."
(10003 / _want_v_1
       :lnk "<22:28>"
       :ARG1-NEQ (10002 / _child_n_1
                        :lnk "<13:21>"
                        :RSTR-H-of (10000 / _the_q
                                          :lnk "<0:3>")
                        :ARG1-EQ-of (10001 / _cheerful_a_1
                                           :lnk "<4:12>"))
       :ARG2-H (10005 / _and_c
                      :lnk "<37:40>"
                      :L-HNDL-HEQ (10004 / _sing_v_1
                                         :lnk "<32:36>"
                                         :ARG1-NEQ 10002)
                      :L-INDEX-NEQ 10004
                      :R-HNDL-HEQ (10006 / _dance_v_1
                                         :lnk "<41:47>"
                                         :ARG1-NEQ 10002)
                      :R-INDEX-NEQ 10006))

; "This technique is impossible to apply."
(10002 / _impossible_a_for
       :lnk "<18:28>"
       :ARG1-H (10003 / _apply_v_2
                      :lnk "<32:38>"
                      :ARG2-NEQ (10001 / _technique_n_1
                                       :lnk "<5:14>"
                                       :RSTR-H-of (10000 / _this_q_dem
                                                         :lnk "<0:4>"))))

; "All dogs chased a cat."
(10002 / _chase_v_1
       :lnk "<9:15>"
       :ARG1-NEQ (10001 / _dog_n_1
                        :lnk "<4:8>"
                        :RSTR-H-of (10000 / _all_q
                                          :lnk "<0:3>"))
       :ARG2-NEQ (10004 / _cat_n_1
                        :lnk "<18:22>"
                        :RSTR-H-of (10003 / _a_q
                                          :lnk "<16:17>")))

Sadly, DMRS is not available via Stephan's server. Also see this utility I created for some experiments doing neural generation from PENMAN-serialized DMRS. We used the utility to convert the Redwoods corpus.

@goodmami
Copy link
Member

@nschneid is this what you're looking for? Or can I help you with something else?

@goodmami
Copy link
Member

Closing this issue. Please reopen if I didn't answer your question. Thanks

@nschneid
Copy link
Author

@goodmami, thanks, this gives me a flavor of ERS. The DMRS variant is still a mystery to me, but I haven't got around to watching Emily's tutorial.

@goodmami
Copy link
Member

Thanks for responding. I should have mentioned that the :lnk character alignments are optional, and they might just be clutter if you're not familiar with *MRS, so below I reproduce the last example, in EDS and DMRS, with them removed. I also normalized the node identifiers so the interesting differences between EDS and DMRS are more apparent.

; "All dogs chased a cat." (EDS version)
(e2 / _chase_v_1
    :ARG1 (x3 / _dog_n_1
              :BV-of (_1 / _all_q))
    :ARG2 (x8 / _cat_n_1
              :BV-of (_2 / _a_q)))

; "All dogs chased a cat." (DMRS version)
(e2 / _chase_v_1
    :ARG1-NEQ (x3 / _dog_n_1
                  :RSTR-H-of (_1 / _all_q))
    :ARG2-NEQ (x8 / _cat_n_1
                  :RSTR-H-of (_2 / _a_q)))

@ghost
Copy link

ghost commented Jul 13, 2018

Hi, I am trying to convert the MRS/EDS of sdp2015 into penman style. I found some of the sentences could not be converted though they are not disconnected.

Here is an example:

sentence:
"By 1997, almost all remaining uses of cancer-causing asbestos will be outlawed."

MRS:
[ LTOP: h1
INDEX: e3 [ e SF: PROP TENSE: FUT MOOD: INDICATIVE PROG: - PERF: - ]
RELS: <
[ focus_d_rel<0:79>
LBL: h2
ARG0: e5 [ e SF: PROP ]
ARG1: e3
ARG2: e4 [ e SF: PROP TENSE: UNTENSED MOOD: INDICATIVE PROG: - PERF: - ] ]
[ _by_p_temp_rel<0:2>
LBL: h2
ARG0: e4
ARG1: e3
ARG2: x6 [ x PERS: 3 NUM: SG IND: + ] ]
[ proper_q_rel<3:8>
LBL: h7
ARG0: x6
RSTR: h8
BODY: h9 ]
[ yofc_rel<3:8>
LBL: h10
ARG0: x6
CARG: "1997" ]
[ "_almost_x_deg_rel"<9:15>
LBL: h11
ARG0: e12 [ e SF: PROP TENSE: UNTENSED MOOD: INDICATIVE PROG: - PERF: - ]
ARG1: u13 ]
[ _all_q_rel<16:19>
LBL: h11
ARG0: x14 [ x PERS: 3 NUM: PL ]
RSTR: h15
BODY: h16 ]
[ "_remaining_a_1_rel"<20:29>
LBL: h17
ARG0: e18 [ e SF: PROP TENSE: UNTENSED MOOD: INDICATIVE ]
ARG1: x14 ]
[ "_use_n_of_rel"<30:34>
LBL: h17
ARG0: x14
ARG1: x19 [ x PERS: 3 NUM: SG GEND: N IND: - ] ]
[ udef_q_rel<38:61>
LBL: h20
ARG0: x19
RSTR: h21
BODY: h22 ]
[ compound_rel<38:52>
LBL: h23
ARG0: e26 [ e SF: PROP TENSE: UNTENSED MOOD: INDICATIVE PROG: - PERF: - ]
ARG1: e24 [ e SF: PROP TENSE: UNTENSED MOOD: INDICATIVE PROG: + PERF: - ]
ARG2: x25 ]
[ udef_q_rel<38:52>
LBL: h27
ARG0: x25
RSTR: h28
BODY: h29 ]
[ "_cancer_n_1_rel"<38:52>
LBL: h30
ARG0: x25 ]
[ "_cause_v_1_rel"<38:52>
LBL: h23
ARG0: e24
ARG1: x19
ARG2: p31 ]
[ "_asbestos_n_1_rel"<53:61>
LBL: h23
ARG0: x19 ]
[ "_outlaw_v_1_rel"<70:79>
LBL: h2
ARG0: e3
ARG1: i32
ARG2: x14 ]
[ parg_d_rel<70:79>
LBL: h2
ARG0: e33 [ e SF: PROP ]
ARG1: e3
ARG2: x14 ] >
HCONS: < h28 QEQ h30 h21 QEQ h23 h15 QEQ h17 h8 QEQ h10 h1 QEQ h2 > ]

EDS:
{e3:
e4:_by_p_temp<0:2>[ARG1 e3, ARG2 x6]
x6:yofc<3:8>("1997")[]
e12:_almost_x_deg<9:15>[ARG1 _2]
_2:_all_q<16:19>[BV x14]
e18:_remaining_a_1<20:29>[ARG1 x14]
x14:_use_n_of<30:34>[ARG1 x19]
e26:compound<38:52>[ARG1 e24, ARG2 x25]
x25:_cancer_n_1<38:52>[]
e24:_cause_v_1<38:52>[ARG1 x19]
x19:_asbestos_n_1<53:61>[]
e3:_outlaw_v_1<70:79>[ARG2 x14]
}

the graph:
parse.gv22.pdf

When I run the conversion code in pydelphin, the error occurred as Invalid graph; possibly disconnected. But I am not sure why this happened.

@goodmami
Copy link
Member

@PKUzilin I think this should be in a separate issue. Please follow #156 instead. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants