zensols.amr.wlk package¶
Submodules¶
zensols.amr.wlk.amr_similarity module¶
zensols.amr.wlk.graph_helpers module¶
- class zensols.amr.wlk.graph_helpers.GraphParser(input_format='penman', edge_to_node_transform=False)[source]¶
Bases:
object
- zensols.amr.wlk.graph_helpers.amrtriples2nxmedigraph(triples, edge_to_node_transform=False)[source]¶
builds nx medi graph from amr triples.
- Parameters:
- Returns:
nx multi edge di graph where nodes are ids and nodes and labels carry attribute “label”.
- zensols.amr.wlk.graph_helpers.get_var_concept_map(triples)[source]¶
- creates a dictionary that maps varibales to their concepts
e.g., [(x, :instance, y),…] —> {x:y,…}
- Parameters:
triples (list) – triples
- Returns:
dictionary
- zensols.amr.wlk.graph_helpers.get_var_index_map(triples)[source]¶
- creates a dictionary that maps varibales to indeces
e.g., [(x, :instance, y),…] —> {x:y,…}
- Parameters:
triples (list) – triples
- Returns:
dictionary
- zensols.amr.wlk.graph_helpers.nx_digraph_to_triples(G)[source]¶
convert nx graph to triples. Attention: there may be info loss
- zensols.amr.wlk.graph_helpers.stringamr2graph(string)[source]¶
uses penman to convert serialized AMR to penman graph
- Parameters:
string (str) – serialized AMR ‘(n / concept :arg1 ()…)’
- Returns:
penman graph object
- zensols.amr.wlk.graph_helpers.tsv2triples(string)[source]¶
Parses tsv graph to triples
- Parameters:
string (str) –
tsv graph e.g.
x y :edge_1 y z :edge_2 z x :edge_3 x dog :instance y cat :instance z like :instance
defines a graph between source and target nodes with edge labels. Node labels are indicated with special :instance edge
- Returns:
triples
zensols.amr.wlk.score module¶
Module contents¶
Weisfeiler-Leman Graph Kernels for AMR Graph Similarity
Juri Opitz, Angel Daza, and Anette Frank. 2021. Weisfeiler-Leman in the Bamboo: Novel AMR Graph Metrics and a Benchmark for AMR Graph Similarity. Transactions of the Association for Computational Linguistics, 9:1425–1441.
- see: