IBM / transition-amr-parser

SoTA Abstract Meaning Representation (AMR) parsing with word-node alignments in Pytorch. Includes checkpoints and other tools such as statistical significance Smatch.
Apache License 2.0
231 stars 46 forks source link

No same-as edges in example for docamr #55

Open aolney opened 5 months ago

aolney commented 5 months ago

Running the example docamr code below does not give same-as edges for coreference:

from transition_amr_parser.parse import AMRParser

# Download and save the docamr model to cache
parser = AMRParser.from_pretrained('doc-sen-conll-amr-seed42')

# Sentences in the doc
doc = ["Hailey likes to travel." ,"She is going to London tomorrow.", "She will walk to Big Ben when she goes to London."]

# tokenize sentences if not already tokenized
tok_sentences = []
for sen in doc:
    tokens, positions = parser.tokenize(sen)
    tok_sentences.append(tokens)

# parse docs takes a list of docs as input
annotations, machines = parser.parse_docs([tok_sentences])

# Print Penman notation
print(annotations[0])

# Print Penman notation without JAMR, with ISI
amr = machines[0].get_amr()
print(amr.to_penman(jamr=False, isi=True))

# Plot the graph (requires matplotlib)
amr.plot()

Instead I get a warning for disconnected graphs and this output: image

Bryan-Stearns commented 2 months ago

I have this same issue. I also tried other sentences, like ["I held my son.", "He is 3 months old."]. In that instance, the sentences were united under the "multi-sentence" node, but that was the only union. There was no link across sentences at all, no "same-as" edges.