penman.surface#
Surface strings, tokens, and alignments.
Epigraphical Markers#
- class penman.surface.Alignment(indices, prefix=None)[source]#
Bases:
AlignmentMarker
- class penman.surface.RoleAlignment(indices, prefix=None)[source]#
Bases:
AlignmentMarker
Module Functions#
- penman.surface.alignments(g)[source]#
Return a mapping of triples to alignments in graph g.
- Parameters:
g – a
Graph
containing alignment data- Returns:
A
dict
mappingTriple
objects to their correspondingAlignment
objects, if any.
Example
>>> from penman import decode >>> from penman import surface >>> g = decode( ... '(c / chase-01~4' ... ' :ARG0~5 (d / dog~7)' ... ' :ARG0~3 (c / cat~2))') >>> surface.alignments(g) {('c', ':instance', 'chase-01'): Alignment((4,)), ('d', ':instance', 'dog'): Alignment((7,)), ('c', ':instance', 'cat'): Alignment((2,))}
- penman.surface.role_alignments(g)[source]#
Return a mapping of triples to role alignments in graph g.
- Parameters:
g – a
Graph
containing role alignmentdata –
- Returns:
A
dict
mappingTriple
objects to their correspondingRoleAlignment
objects, if any.
Example
>>> from penman import decode >>> from penman import surface >>> g = decode( ... '(c / chase-01~4' ... ' :ARG0~5 (d / dog~7)' ... ' :ARG0~3 (c / cat~2))') >>> surface.role_alignments(g) {('c', ':ARG0', 'd'): RoleAlignment((5,)), ('c', ':ARG0', 'c'): RoleAlignment((3,))}