goodbai-nlp / AMRBART

Code for our paper "Graph Pre-training for AMR Parsing and Generation" in ACL2022
MIT License
92 stars 28 forks source link

Question about AMR data format #18

Closed tingchihc closed 1 year ago

tingchihc commented 1 year ago

I want to inference my own data in AMR2Text. However, I do not understand how can I adjust my AMR to this format. Could you explain? and what does mean? Could you provide the code for translating AMR to this format?

{"sent": "", "amr": "( <pointer:0> pledge-01 :mode imperative :ARG0 ( <pointer:1> you ) :ARG2 ( <pointer:2> fight-01 :ARG0 <pointer:1> :ARG2 ( <pointer:3> defend-01 :ARG0 <pointer:1> :ARG1 ( <pointer:4> and :op1 ( <pointer:5> island :wiki \"Senkaku_Islands\" :name ( <pointer:6> name :op1 \"Diaoyu\" :op2 \"Islands\" ) ) :op2 ( <pointer:7> island :ARG1-of ( <pointer:8> relate-01 :ARG2 <pointer:5> ) ) ) ) :manner ( <pointer:9> die-01 :ARG1 <pointer:1> ) ) )"}

thanks,

goodbai-nlp commented 1 year ago

Hi, @ting-chih

Please refer to this repository for data processing. <pointer: X> is used to mark AMR concepts so that we can deal with reentrancies in AMR graphs.

tingchihc commented 1 year ago

Hi, @goodbai-nlp

thanks for your reply. I understand your meaning. However I am not working on LDC2017 or LDC2020 datasets and I do not have these datasets. So, I am not sure what is your preprocessing strategy. Could you let me take a look in these datasets? or Could you show me one example in these datasets to let me know how to adjust code for my own data?

My dataset looks like this [["r2", ":instance", "romance-01"], ["r2", ":ARG0", "a"], ["a", ":op1", "p"], ["p", ":name", "n"], ["a", ":op2", "p2"], ["p2", ":name", "n2"], ["a", ":instance", "and"], ["p", ":instance", "person"], ["n", ":instance", "name"], ["p2", ":instance", "person"], ["n2", ":instance", "name"], ["n", ":op1", "\"Maisie\""], ["n", ":op2", "\"Smith\""], ["n2", ":op1", "\"HRVY\""]]. This is a list about AMR triplets and I will use your model to do AMR2Text.

goodbai-nlp commented 1 year ago

Hi, @ting-chih

Please refer to the following image for the standard AMR format. You may need to reconstruct the original AMR graph from AMR triplets. For :snt, annotator, you can replace corresponding content with NULL. For example,

# ::id 0
# ::annotator NULL
# ::snt NULL
(
your AMR graph here
...
)
image
tingchihc commented 1 year ago

ok thanks for your image. I understand.